首页 > 代码库 > php-fpm启动脚本

php-fpm启动脚本

1.安装php时,在源码目录下默认有个脚本文件,拷贝到/etc/init.d目录下就可以直接用

[root@web-node01 ~]# cp /usr/local/src/php-5.6.20/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

2.注意,php-fpm启动脚本依赖与php-fpm.pid文件,此时需要在php-fpm.conf开启pid参数

[root@web-node01 ~]# vim /usr/local/php/etc/php-fpm.conf  1 ;;;;;;;;;;;;;;;;;;;;;  2 ; FPM Configuration ;  3 ;;;;;;;;;;;;;;;;;;;;;  4   5 ; All relative paths in this configuration file are relative to PHPs install  6 ; prefix (/usr/local/php-5.6.20). This prefix can be dynamically changed by using the  7 ; -p argument from the command line.  8   9 ; Include one or more files. If glob(3) exists, it is used to include a bunch of 10 ; files from a glob(3) pattern. This directive can be used everywhere in the 11 ; file. 12 ; Relative path can also be used. They will be prefixed by: 13 ;  - the global prefix if its been set (-p argument) 14 ;  - /usr/local/php-5.6.20 otherwise 15 ;include=etc/fpm.d/*.conf 16  17 ;;;;;;;;;;;;;;;;;; 18 ; Global Options ; 19 ;;;;;;;;;;;;;;;;;; 20  21 [global] 22 ; Pid file 23 ; Note: the default prefix is /usr/local/php-5.6.20/var 24 ; Default Value: none 25 pid = run/php-fpm.pid             # 注释取消 26 

3.启动测试

[root@web-node01 ~]# /etc/init.d/php-fpm stopGracefully shutting down php-fpm . done[root@web-node01 ~]# /etc/init.d/php-fpm startStarting php-fpm  done

 

php-fpm启动脚本