先装php5.3.5
'./configure' '--prefix=/home/php535' '--enable-xml' '--enable-fpm' '--with-curl'
这里最重要的是--enable-fpm。fastcgi已经在php5.3.5的core中了,不必再configure时--enable-fastcgi了。老版本的需要加,比如5.2
make && make install
这都是顺利的,然后就不知怎么启,误以为phppath/sbin/php-fpm就行了,可是一直起不来,报错:failed to post process the configuration。baidu了一个周末,还是不明白。觉得我已在etc下写了php-fpm.conf了呀,又以phppath/sbin/php-fpm -y etc/php-fpm.conf起,依然起不来。想了N久,觉得它这里指的conf文件应该php.ini,于是从源码中把php.ini找到,拷了过来,依然起不来.......
在php社区中逛时,发现有人提到的init.d.php-fpm。于是从源码中把它拷过来, phppath/init.d.php-fpm start。就起来了。。。
这都哪儿跟哪儿啊。
nginx其实已装了,只是光能解析html,于是改了nginx.conf文件
location ~ /.php$ {
# root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi.conf;
}
把这段加上,写了个index.php,果然可以解析了。。。。
ps:init.d.php-fpm start这个如果重新运行了时,一定nginx也要重新启一下,否则,虽然php-fpm与nginx通信的端口起来了,但nginx所listen的端口仍然没有起来
其实,nginx支持平滑重启,不必停止服务的,这也是它广受好评的原因。具体的命令就是kill -HUP `cat yourpath/nginx/logs/nginx.pid`
但这个重启,并不好,在nginx.conf有问题时(也许是新加了模块时),并未真正重启,还是用nginx/sbin/nginx -c nginx.conf吧。当然停止用nginx/sbin/nginx -s stop
还是觉得,只是上网找别人写的例子,不够。尤其有的人写的太短,根本没说明白怎么样一步一步地修改,安装,有些人写的太长,扯来扯去的,找不出骨架。
我写的也不好。。。。所以写个技术文档,不是个容易的活。。。