本篇内容介绍了“Linux下php5.4启动脚本详细步骤”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
废话不多说,直接上步骤
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启动脚本详细步骤”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。