After compiling the installation PHP-FPM, the default is not to turn on automatic startup, and some configuration is required to boot.
Execute VIM/ETC/INIT.D/PHP-FPM The following new content:
#!/bin/sh
#
# Php-fpm-this script starts and stops the PHP-FPM daemin
#
# Chkconfig:-85 15
# PROCESSNAME:PHP-FPM
# config:/usr/local/php/etc/php-fpm.conf
Set-e
#PATH =/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
desc= "PHP-FPM Daemon"
name=php-fpm
daemon=/usr/local/php/sbin/$NAME #这里设成自己的目录
Configfile=/usr/local/php/etc/php-fpm.conf #这里设成自己的目录
pidfile=/var/run/$NAME. PID #这里设成自己的目录
scriptname=/etc/init.d/$NAME #这里设成自己的目录
# If The daemon file is not found, terminate the script.
Test-x $DAEMON | | Exit 0
D_start () {
$DAEMON-y $CONFIGFILE | | Echo-n "Already Running"
}
D_stop () {
Kill-quit ' Cat $PIDFILE ' | | Echo-n "No Running"
}
D_reload () {
KILL-USR2 ' Cat $PIDFILE ' | | Echo-n "Could not reload"
}
Case "$" in
Start
Echo-n "Starting $DESC: $NAME"
D_start
echo "."
;;
Stop
Echo-n "Stopping $DESC: $NAME"
D_stop
echo "."
;;
Reload
Echo-n "Reloading $DESC configuration ..."
D_reload
echo "Reloaded."
;;
Restart)
Echo-n "Restarting $DESC: $NAME"
D_stop
# Sleep for two seconds before starting again,
# This should give the Nginx daemon some time to perform a graceful stop
Sleep 2
D_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload)" >&2
Exit 3
;;
Esac
Exit 0
Add executable permissions
chmod +x/etc/init.d/php-fpm
Add to boot auto start
Chkconfig--add PHP-FPM
Chkconfig PHP-FPM on
After that, the PHP-FPM will start up automatically, and the following command can be used to reboot
Service PHP-FPM Start
Service PHP-FPM Stop
Service PHP-FPM Reload
Another kind of smooth restart PHP-FPM can use KILL-USR2 php-fpm.pid, through the service command is much faster