新建用户及用户组
groupadd webuser
useradd -g webuser webuser
下载php-5.5
下载链接:http://pan.baidu.com/s/1i3CBshv
解包
tar zxvf php-5.5.4.tar.gz
cd php-5.5.4
./configure --prefix=/server/php5 \
--with-mysql=/server/mysql \
--with-mysqli \
--with-jpeg-dir=/usr/lib64 \
--with-gd \
--with-curl \
--enable-mbstring=all \
--with-config-file-path=/server/php5/etc \
--enable-force-cgi-redirect \
--enable-soap \
--enable-fastcgi \
--enable-fpm
编译 并 安装
make && make install
cp ./php.ini-production /server/php5/etc/php.ini
编辑include_path
vi /server/php5/etc/php.ini
include_path = ".:/php/includes:/server/php5/lib/php"
cgi.fix_pathinfo=1
date.timezone = Asia/Shanghai
配置php-fpm
vi /server/php5/etc/php-fpm.conf
<value name="user">webuser</value>
<value name="group">webuser</value>
可以启动 php-fpm了
/server/php5/sbin/php-fpm start
编辑 nginx.conf
location ~ \.php$ {
root /web/xinfilm;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_intercept_errors on;
error_page 404 /404.html;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
重启Nginx完成配置
/server/nginx/sbin/nginx -s restart
结合Nginx以cgi方式安装php5.5.4