php環境安裝不少次了,此次仍是整了半天,記錄下後面好少走彎路.php
php7 : http://windows.php.net/download#php-7.0html
vc14: https://www.microsoft.com/zh-CN/download/details.aspx?id=48145 (vcruntime14)mysql
nginx: http://nginx.org/en/download.htmlnginx
RunHiddenConsole: http://redmine.lighttpd.net/attachments/660/RunHiddenConsole.zipsql
D盤建立了個 nmp的目錄windows
解壓到 D:/nmp/phpphp7
複製一份php.ini-development 爲php.inicurl
更改php.ini extension=php_bz2.dllurl
extension=php_curl.dllspa
extension=php_gd2.dll
extension=php_mbstring.dll
extension=php_openssl.dll
extension=php_pdo_mysql.dll
extension=php_pgsql.dll
這些前面的分號註釋去掉
extension_dir = "ext"
解壓到 D:/nmp/nginx
更改config/nginx.conf
location / { root D:/nmp/www; index index.html index.htm; } #這裏最好多個,不然會有curl localhost不成功的狀況 upstream myfastcgi { 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; }
注意 這裏的 D:/nmp/www; 不要寫成 D:\nmp\www; 不然\n 會被轉義。
location ~ \.php$ { root D:/nmp/www; fastcgi_pass myfastcgi; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
RunHiddenConsole 解壓到D:\nmp
啓動腳本 start.bat
@ECHO OFF ECHO Starting PHP FastCGI... set PHP_FCGI_MAX_REQUESTS=100 D:\nmp\RunHiddenConsole.exe D:\nmp\php\php-cgi.exe -b 127.0.0.1:9000 -c D:\nmp\php\php.ini D:\nmp\RunHiddenConsole.exe D:\nmp\php\php-cgi.exe -b 127.0.0.1:9001 -c D:\nmp\php\php.ini D:\nmp\RunHiddenConsole.exe D:\nmp\php\php-cgi.exe -b 127.0.0.1:9002 -c D:\nmp\php\php.ini D:\nmp\RunHiddenConsole.exe D:\nmp\php\php-cgi.exe -b 127.0.0.1:9003 -c D:\nmp\php\php.ini echo Starting nginx... RunHiddenConsole D:\nmp\nginx\nginx.exe -p D:\nmp\nginx ping 127.0.0.1 -n 1>NUL echo . echo . echo . ping 127.0.0.1 >NUL
中止腳本 stop.bat
@ECHO OFF taskkill /f /IM nginx.exe taskkill /f /IM php-cgi.exe EXIT
直接雙擊 start.bat 啓動, stop.bat 中止。 啓動若是提示,找不到vcruntime14.dll 記得安裝vc14 哈,若是你經常使用vs 直接安裝個vs2015吧