突然想搞一下php的运行环境,做点小东西,于是乎开始百度.....忙活半天后,发现其他人的文章,不是照抄就是
一点用处都没有,或者把你引入绝境!!!!!,自己去翻阅官网文档(纯英文,但是很无奈...)吧.
这是记录一下过程,以便帮助其他人,至于为什么用php5.6 而不是7,感觉老版本稳定
1.下载php5.6.30
2.编译安装
tar zxf php-x.x.x
cd ../php-x.x.x
./configure --enable-fpm --with-mysql
make
make install
3.准备运行环境
cd php-x.x.x.源码路径
cp php.ini-development /usr/local/php/php.ini
cp /usr/local/etc/php-fpm.conf.default /usr/local/etc/php-fpm.conf
cp sapi/fpm/php-fpm /usr/local/bin
4.修改运行配置
vim /usr/local/php/php.ini
#Locate cgi.fix_pathinfo= and modify it as follows:
cgi.fix_pathinfo=0
vim /usr/local/etc/php-fpm.conf
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
user = www-data
group = www-data
5.启动
/usr/local/bin/php-fpm
6.tengine配置修改
location / {
root html;
index index.php index.html index.htm;
}
location ~* \.php$ {
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
7.tengine启动
sudo /usr/local/nginx/sbin/nginx -s stop
sudo /usr/local/nginx/sbin/nginx
8.写一个测试文件,丢在tengine的html目录里面
rm /usr/local/nginx/html/index.html
echo "" >> /usr/local/nginx/html/index.php
官网文档,http://php.net/manual/en/install.unix.nginx.php,这是不主介绍tengine的安装,很简
单的,参考tengine的官网文档即可