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吧