我結束了此解決方案:你只需啓動幾個PHP-CGI進程,並將其綁定到不同的端口,你需要更新nginx的配置:
http {
upstream php_farm {
server 127.0.0.1:9000 weight=1;
server 127.0.0.1:9001 weight=1;
server 127.0.0.1:9002 weight=1;
server 127.0.0.1:9003 weight=1;
}
...
server {
...
fastcgi_pass php_farm;
}
}
爲了方便起見,我創建了簡單批處理文件。
start_sandbox.bat
:
@ECHO OFF
ECHO Starting sandbox...
RunHiddenConsole.exe php\php-cgi.exe -b 127.0.0.1:9000 -c php\php.ini
RunHiddenConsole.exe php\php-cgi.exe -b 127.0.0.1:9001 -c php\php.ini
RunHiddenConsole.exe php\php-cgi.exe -b 127.0.0.1:9002 -c php\php.ini
RunHiddenConsole.exe php\php-cgi.exe -b 127.0.0.1:9003 -c php\php.ini
RunHiddenConsole.exe mysql\bin\mysqld --defaults-file=mysql\bin\my.ini --standalone --console
cd nginx && START /B nginx.exe && cd ..
和stop_sandbox.bat
:
pstools\pskill php-cgi
pstools\pskill mysqld
pstools\pskill nginx
,你可以看到,有2個依賴關係:pstools和runhiddenconsole.exe
輝煌,謝謝。 – 2015-10-16 21:53:30