windows 本地搭建php+nginx环境 一键启动

PHP · 2023-07-11

本地安装好nginx,php 不用启动。
修改下面文件路径配置 可做到 php多版本兼容

// bat 文件
@echo off
taskkill /F /IM nginx.exe > nul
echo Stopping PHP FastCGI...
taskkill /F /IM php-cgi.exe > nul
set PHP_FCGI_MAX_REQUESTS = 1000
echo Starting PHP FastCGI...
rem 下面这里的分别替换成你的php-cgi.exe和php.ini的路径 ,后面的-b,-c等参数必须保留且注意前后空格

RunHiddenConsole.exe E:/Server/phps/php-5.6.17-Win32-VC11-x64/php-cgi.exe -b 127.0.0.1:9956 -c E:/Server/phps/php-5.6.17-Win32-VC11-x64/php.ini 
RunHiddenConsole.exe E:/Server/phps/php-7.2.34-Win32-VC15-x64/php-cgi.exe -b 127.0.0.1:9972 -c E:/Server/phps/php-7.2.34-Win32-VC15-x64/php.ini 
RunHiddenConsole.exe E:/Server/phps/php-7.4.26-Win32-vc15-x64/php-cgi.exe -b 127.0.0.1:9974 -c E:/Server/phps/php-7.4.26-Win32-vc15-x64/php.ini 
RunHiddenConsole.exe E:/Server/phps/php-8.0.22-nts-Win32-vs16-x64/php-cgi.exe -b 127.0.0.1:9980 -c E:/Server/phps/php-8.0.22-nts-Win32-vs16-x64/php.ini 
RunHiddenConsole.exe E:/Server/phps/php-8.1.9-nts-Win32-vs16-x64/php-cgi.exe -b 127.0.0.1:9981 -c E:/Server/phps/php-8.1.9-nts-Win32-vs16-x64/php.ini 
echo Starting nginx...
rem 注意替换成你的nginx目录
RunHiddenConsole.exe  E:\Server\nginx-1.16.1/nginx.exe -p E:\Server\nginx-1.16.1/
msg %username% /time:3 本地服务已启动~~
windows环境 php+nginx
Theme Jasmine by Kent Liao