PHP-FPM启动脚本设置
首先cd到/etc/init.d/下
创建出php-fpm文件
接下来上代码
#!/bin/bash # # Startup script for the PHP-FPM server. # # chkconfig: 345 85 15 # description: PHP is an HTML-embedded scripting language # processname: php-fpm # config: /usr/local/php/etc/php.ini # Source function library. #用which php-fpm找到你文件的位置
PHP_PATH=/usr/local DESC="php-fpm daemon" NAME=php-fpm # php-fpm路径 DAEMON=$PHP_PATH/php/sbin/$NAME # 配置文件路径 CONFIGFILE=$PHP_PATH/php/etc/php-fpm.conf # PID文件路径(在php-fpm.conf设置) PIDFILE=$PHP_PATH/php/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME # Gracefully exit if the package has been removed. test -x $DAEMON || exit 0 rh_start() { $DAEMON -y $CONFIGFILE || echo -n " already running" } rh_stop() { kill -QUIT `cat $PIDFILE` || echo -n " not running" } rh_reload() { kill -HUP `cat $PIDFILE` || echo -n " can't reload" } case "$1" in start) echo -n "Starting $DESC: $NAME" rh_start echo "." ;; stop) echo -n "Stopping $DESC: $NAME" rh_stop echo "." ;; reload) echo -n "Reloading $DESC configuration..." rh_reload echo "reloaded." ;; restart) echo -n "Restarting $DESC: $NAME" rh_stop sleep 1 rh_start echo "." ;; *) echo "Usage: $SCRIPTNAME {start|stop|restart|reload}" >&2 exit 3 ;; esac exit 0
更改权限
sudo chmod +x /etc/init.d/php-fpm
之后利用以下命令
service php-fpm start service php-fpm stop service php-fpm restart service php-fpm reload /etc/init.d/php-fpm start /etc/init.d/php-fpm stop /etc/init.d/php-fpm restart /etc/init.d/php-fpm reload
大功告成!