HJM

导航

php源代码安装

1.在官网下载php安装源文件。版本选择5的最新稳定版。
[root@trial download]# wget http://cn.php.net/distributions/php-5.5.38.tar.gz

2.下载下来的是一个mirror文件,重命名为php-5.5.38.tar.gz,并解压到源文件目录
[root@trial download]# tar -zxvf php-5.5.38.tar.gz -C /usr/local/src/
[root@trial download]# cd /usr/local/src/php-5.5.38/

  1. 编译安装
    [root@trial php-5.5.38]# ./configure --prefix=/usr/local/php5.5.38 --with-mysql=mysqlnd --enable-mysqlnd --with-gd --enable-gd-native-ttf --enable-gd-jis-conv --enable-fpm
    [root@trial php-5.5.38]# make
    [root@trial php-5.5.38]# make install

  2. 配置
    [root@trial php-5.5.38]# cd /usr/local/php5.5.38/
    [root@trial php5.5.38]# cp etc/php-fpm.conf.default etc/php-fpm.conf
    [root@trial php5.5.38]# vim /usr/local/nginx1.6.3/conf/nginx.conf

     location ~ \.php$ {
         root           html;
         fastcgi_pass   127.0.0.1:9000;
         fastcgi_index  index.php;
         fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
         include        fastcgi_params;
     }
    

此段取消注释,然后红色字体部分修改为$document_root

  1. 启动
    [root@trial php]# sbin/php-fpm

6.验证
[root@trial php5.5.38]# netstat -nltup |grep 9000 #若有抓到9000端口,说明php起来了。
[root@trial html]# echo '' > phpinfo.php
访问到php信息页,说明php配置好了

QA:
configure时报错误
configure: error: xml2-config not found. Please check your libxml2 installation.
检查libxml2已经安装,但是libxml2-devel未安装。
解决
[root@trial php-5.5.38]# yum -y install libxml2-devel.i686

configure时报错误:
configure: error: png.h not found.
解决:
[root@trial php-5.5.38]# yum -y install libpng libpng-devel

posted on 2017-10-24 12:44  kennminn  阅读(675)  评论(0编辑  收藏  举报