Linux下php5.4启动脚本详细步骤-创新互联
本篇内容介绍了“Linux下php5.4启动脚本详细步骤”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
成都创新互联公司提供成都网站设计、成都做网站、网页设计,成都品牌网站建设,1元广告等致力于企业网站建设与公司网站制作,10年的网站开发和建站经验,助力企业信息化建设,成功案例突破超过千家,是您实现网站建设的好选择.废话不多说,直接上步骤
1、修改php-fpm.conf配置文件
修改/usr/local/php/etc/php-fpm.conf(当然这个跟你配置的php路径相关)配置文件
启动pid=run/php-fpm.pid
; Pid file ; Note: the default prefix is /usr/local/php/var ; Default Value: none pid = run/php-fpm.pid
启动error_log=log/php-fpm.log
; Error log file ; If it's set to "syslog", log is sent to syslogd instead of being written ; in a local file. ; Note: the default prefix is /usr/local/php/var ; Default Value: log/php-fpm.log error_log = log/php-fpm.log
2、创建/etc/init.d/php文件
root@aliyun:~# cat /etc/init.d/php #!/bin/bash #Author:iranw #E-mail:wang_wenguan#yeah.net #Website:http://www.phpno.com # pid file pid="/usr/local/php/var/run/php-fpm.pid" # php-fpm path&file phpfpm="/usr/local/php/sbin/php-fpm" param=$1 phpnum=`ps -ef | grep php-fpm | wc -l` if [ "$param" = "stop" ]; then if [ "$phpnum" = "1" ]; then echo "Php process does not exist." exit 1 fi kill `cat $pid` echo "Close php processes. OK" exit 1 fi if [ "$param" = "start" ]; then if [ "$phpnum" != "1" ]; then echo "Php process exist." exit 1 fi $phpfpm echo "Open php processes. OK" exit 1 fi if [ "$param" = "restart" ]; then if [ "$phpnum" = "1" ]; then echo "Php process does not exist. Stop Failed." else kill `cat $pid` for i in `ps -ef | grep php-fpm | grep -v grep | awk {'print $2'}` do kill -9 $i echo "Kill $i successed." done echo "Close php processes. OK" fi $phpfpm if [ "$phpnum" != "1" ]; then echo "Open php processes. OK" else echo "Open php processes. Failed." fi exit 1 fi
3、修改权限
#chmod +x /etc/init.d/php
4、执行结果
“Linux下php5.4启动脚本详细步骤”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注创新互联网站,小编将为大家输出更多高质量的实用文章!
新闻标题:Linux下php5.4启动脚本详细步骤-创新互联
文章源于:http://ybzwz.com/article/idosj.html