安装完PHP后,自身有启动脚本,比如本人安装路径为:/usr/local/php
源码路径为:/usr/local/src/php-5.4.38
[root@lnmp ~]# cp /usr/local/src/php-5.4.38/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
[root@lnmp ~]# chmod +x /etc/init.d/php-fpm #赋予执行权限
[root@lnmp ~]# chkconfig --add php-fpm
[root@lnmp ~]# service php-fpm status
php-fpm is stopped
[root@lnmp ~]# service php-fpm start
Starting php-fpm done
本人由于之前是通过[root@lnmp ~]# /usr/local/php/sbin/php-fpm 已经开启php,此时如果报错
[root@lnmp ~]# /etc/init.d/php-fpm start
Starting php-fpm [23-Mar-2015 19:51:10] ERROR: unable to bind listening socket for address '127.0.0.1:9000': Address already in use (98)
[23-Mar-2015 19:51:10] ERROR: FPM initialization failed
failed
[root@lnmp ~]# /etc/init.d/php-fpm stop
Gracefully shutting down php-fpm . done
[root@lnmp ~]# /etc/init.d/php-fpm start
Starting php-fpm done