windows下后台启动PHP,Nginx,Redis(使用RunHiddenConsole)
阅读原文时间:2023年07月09日阅读:2

启动命令(红色代码可选):

启动PHP

RunHiddenConsole D:/phpStudy/PHPTutorial/php/php-5.6.27-nts/php-cgi.exe -b 127.0.0.1:9000 -c D:/phpStudy/PHPTutorial/php/php-5.6.27-nts/php.ini

启动nginx

start D:/phpStudy/PHPTutorial/nginx/nginx.exe -p D:/phpStudy/PHPTutorial/nginx

启动MySQL

RunHiddenConsole net start mysql

三合一:

启动PHP,nginx,mysql. 新建start_NMP.bat

@echo off
echo Starting PHP…
RunHiddenConsole D:/phpStudy/PHPTutorial/php/php-5.6.27-nts/php-cgi.exe -b 127.0.0.1:9000 -c D:/phpStudy/PHPTutorial/php/php-5.6.27-nts/php.ini
echo Starting nginx…
start D:/phpStudy/PHPTutorial/nginx/nginx.exe -p D:/phpStudy/PHPTutorial/nginx
echo Starting MySQL…
RunHiddenConsole net start mysql

停止PHP,nginx,mysql. 新建stop_NMP.bat

@echo off
echo Stopping nginx…
taskkill /F /IM nginx.exe > nul
echo Stopping PHP FastCGI…
taskkill /F /IM php-cgi.exe > nul
echo Stopping PHP FastCGI…
taskkill /F /IM mysqld.exe > nul
exit

重启PHP,nginx,mysql. 新建restart_NMP.bat

@echo off
echo Stopping nginx…
taskkill /F /IM nginx.exe > nul
echo Stopping PHP FastCGI…
taskkill /F /IM php-cgi.exe > nul
echo Stopping PHP FastCGI…
taskkill /F /IM mysqld.exe > nul

echo Starting PHP…
RunHiddenConsole D:/phpStudy/PHPTutorial/php/php-5.6.27-nts/php-cgi.exe -b 127.0.0.1:9000 -c D:/phpStudy/PHPTutorial/php/php-5.6.27-nts/php.ini
echo Starting nginx…
start D:/phpStudy/PHPTutorial/nginx/nginx.exe -p D:/phpStudy/PHPTutorial/nginx
echo Starting MySQL…
RunHiddenConsole net start mysql

RunHiddenConsole相关下载:https://www.cnblogs.com/wangzhaobo/p/9673284.html

开机启动PHP,nginx,mysql:

wind+R调出来运行输入shell:startup回车

然后把start_NMP.bat文件放到里面

大功告成! ! !