旗下导航:搜·么
当前位置:网站首页 > PHP问题 > 正文

命令行体式格局启动php效劳【php题目】

作者:搜搜PHP网发布时间:2019-11-26分类:PHP问题浏览:131


导读:装置完php,运用chkconfig敕令来检察php-fpm效劳是不是开启,假如没有开启1.在/etc/init.d/目次下建立剧本php-fpmvim/etc/...

装置完php,运用chkconfig敕令来检察php-fpm效劳是不是开启,假如没有开启

1. 在/etc/init.d/目次下建立剧本php-fpm

vim/etc/init.d/php-fpm

2. 编写剧本内容(将一下复制进去响应修改装置途径)

#!/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=/usr/local/php/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 -HUP `cat $PIDFILE` || echo -n " could notreload"
     }
     case "$1" in
         start)
             echo -n "Starting $DESC: $NAME"
             d_start
             echo "."
             ;;
         stop)
             echo -n "Stopping $DESC: $NAME"
             d_stop
             echo "."
             ;;
         reload)
             echo -n "Reloading $DESCconfiguration..."
             d_reload
             echo "Reloaded."
             ;;
         restart)
             echo -n "Restarting $DESC: $NAME"
             d_stop
             # Sleep for two seconds before startingagain, 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

末了:wq退出保留;

3. 变动剧本权限

chmod775 /etc.init.d/php-fpm

4. 设置开机启动

chkconfigphp-fpm on

可以用敕令chkconfig检察开机效劳列表

更多相干内容请接见ki4网:PHP视频教程

以上就是敕令行体式格局启动php效劳的细致内容,更多请关注ki4网别的相干文章!

标签:命令启动php服务