安装完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 "" 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查看开机服务列表
总结相关推荐:
PHP视频教程:https://www.jb51.cc/course/list/29/type/2.html
以上是内存溢出为你收集整理的开启PHP服务的方法全部内容,希望文章能够帮你解决开启PHP服务的方法所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)