开启PHP服务的方法-php教程

资源魔 26 0

装置完php,应用chkconfig饬令来查看php-fpm效劳能否开启,假如不开启

一、正在/etc/init.d/目次下创立剧本php-fpm

vim/etc/init.d/php-fpm

二、编写剧本内容(将一下复制出来相应改动装置门路)

#!/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加入保留;

三、更改剧本权限

chmod775 /etc.init.d/php-fpm

四、设置开机启动

chkconfigphp-fpm on

能够用饬令chkconfig查看开机效劳列表

相干保举:

PHP视频教程:https://www.php.cn/course/list/29/type/2.html

以上就是开启PHP效劳的办法的具体内容,更多请存眷资源魔其它相干文章!

标签: php php开发教程 php开发资料 php开发自学

抱歉,评论功能暂时关闭!