实验环境:

VM虚拟机

CentOS操作系统

第一种方式:通过脚本

[root@www ~]# cd /etc/init.d

[root@www init.d]# pkill php-fpm

[root@www init.d]# ps -ef|grep php-fpm

root 1657 1629 0 23:11 pts/0 00:00:00 grep php-fpm

[root@www init.d]# vi php-fpm #脚本见附件

[root@www init.d]# chmod a+x php-fpm #添加执行权限

[root@www init.d]# chkconfig --add php-fpm #加入服务

[root@www init.d]# chkconfig php-fpm on #开机自动启动服务

[root@www init.d]# service php-fpm start

[root@www init.d]# ps -ef|grep php-fpm

root 1673 1 0 23:13 ? 00:00:00 php-fpm: master process (/application/php5.3.27/etc/php-fpm.conf)

nginx 1674 1673 0 23:13 ? 00:00:00 php-fpm: pool www

nginx 1675 1673 0 23:13 ? 00:00:00 php-fpm: pool www

root 1677 1629 0 23:13 pts/0 00:00:00 grep php-fpm

第二种方式:

[root@www ~]# vi /etc/rc.local

#追加到末尾

/application/php/sbin/php-fpm

附件:http://down.51cto.com/data/2368462