Linux下安装PHP环境

WBOY
Libérer: 2016-08-08 09:21:58
original
914 Les gens l'ont consulté

 需要的安装包都放在本人的下载资源里面 : http://download.csdn.net/detail/javaxiaojian/8854311

一.  安装Apache

本人提供 httpd-2.2.11.tar.gz

如果需要下载最新,请到官网http://httpd.apache.org/download.cgi  

1.创建apache2目录

mkdir/usr/local/apache2

2.将 httpd-2.2.11.tar.gz放到该目录下

Cd /usr/local/apache2

tar  -zxvf httpd-2.2.11.tar.gz

3. 配置

cd /usr/local/apache2

./configure --prefix=/usr/local/apache2 --enable-module=shared --with-included-apr
Copier après la connexion
  如果在这一步出现错误,请联系me寻求帮助
Copier après la connexion
5、编译
    make    
6、安装
    make install  
7、启动,重启和停止 ,先切换到安装完成后的目录/usr/local/apache2/bin
    ./apachectl -k start
    ./apachectl -k restart
    ./apachectl -k stop  
Copier après la connexion
8、配置文件(满足最基本的配置)
     编辑 /usr/local/apache2/conf/httpd.conf 文件     
     找到:
    AddType  application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    在后面添加:
    AddType application/x-httpd-php .php(使Apcche支持PHP)
    AddType application/x-httpd-php-source .php5   
Copier après la connexion
    找到:
    <ifmodule dir_module>
    DirectoryIndex index.html
    </ifmodule>
    添加:
    <ifmodule dir_module>
    DirectoryIndex index.html index.php
    </ifmodule>    
Copier après la connexion
    找到:
    #ServerName www.example.com:80
    修改为:
    ServerName 127.0.0.1:80或者ServerName localhost:80
    记得要去掉前面的“#” 
Copier après la connexion
   
Copier après la connexion
9、测试
    在浏览器里输入http://ip

    如果出现It Works!说明成功。

一.  安装PHP5.5

本人提供php-5.5.24.tar.gz,5.5属于最稳当的版本

1.      建立mkdir /usr/local/php ,将 php-5.5.24.tar.gz放到该目录下

2.      tar -zxvf php-5.5.24.tar.gz

3.      cd php-5.5.24

4.      配置

 ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs

5、编译
       make   
   6、测试编译
        make test   
   7、安装
      make install

8.将/usr/local/php/php-5.5.24目录下的 php.ini-development 拷贝到 /usr/local/php/lib 目录下,并且改名为  php.ini

9.重启apache

10. 测试

 在apache的htdocs下建立一个php文件test.php,里面的内容如下:
        phpinfo();
    ?>


版权声明:本文为博主原创文章,未经博主允许不得转载。

以上就介绍了Linux下安装PHP环境,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Étiquettes associées:
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!