Linux下php5.4启动脚本

前端之家收集整理的这篇文章主要介绍了Linux下php5.4启动脚本前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

废话不多说,直接上步骤 1、修改PHP-fpm.conf配置文件 修改/usr/local/PHP/etc/PHP-fpm.conf(当然这个跟你配置的PHP路径相关)配置文件

启动pid=run/PHP-fpm.pid

PHP/var ; Default Value: none pid = run/PHP-fpm.pid

启动error_log=log/PHP-fpm.log

PHP/var ; Default Value: log/PHP-fpm.log error_log = log/PHP-fpm.log

2、创建/etc/init.d/PHP文件

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 <a href="https://www.jb51.cc/tag/PHP/" target="_blank" class="keywords">PHP</a>-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 <a href="https://www.jb51.cc/tag/PHP/" target="_blank" class="keywords">PHP</a>-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、修改权限

PHP

4、执行结果

原文链接:https://www.f2er.com/php/24058.html

猜你在找的PHP相关文章