1. Preparation work
(1)PHP version 5.6.17 download address PHP official website
(2)Nginx version 1.8.0 download address Nginx official website
(3)MySQL version 5.7.10 MySQL official website
Installation and configuration of 2.php
), here rename the extracted folder to php5. Enter the folder and modify the php.ini-delelopment file to php.ini, and open it with Editplus or Notepad. Find extension_dir = "ext"
Changed to extension_dir = "D:/wnmp/php5/ext"
Commonly used extensions, remove the leading ";"
extension=php_curl.dll extension=php_gd2.dll
extension=php_mbstring.dll
extension=php_mcrypt.dll
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_pdo.dll
extension=php_pdo_mysql.dll
extension=php_xmlrpc.dll
nginx supports configuration, remove the leading ";"
;cgi.fix_pathinfo=
1;cgi.force_redirect = 1
;cgi.rfc2616_headers = 0. First remove the semicolon and then change it to cgi.rfc2616_headers = 1
3.Nginx installation configuration
Extract the downloaded package to D:wnmp, and directly run nginx.exe in the directory to start.
1. There are 3 startup methods
(1) Double-click the nginx.exe icon, a black window will flash by, and the startup is completed. (2) Go to the nginx directory from the command line and enter nginx to start. (Note: In this method, the command line window has no prompts and is locked)
(3) Go to the nginx directory from the command line and enter start nginx to start. This method will not lock
2. Modify the configuration to support PHP
Enter the nginx conf directory, open the nginx configuration file nginx.conf, and find
Location / { Root html;
#This is the root directory of the site
index index.html index.htm index.php;
}
Will root
root D:/wnmp/www; Go further down and find
# pass the PHP scripts to FastCGI serverlistening on 127.0
.0.1:9000
#
#location ~ .php$ {
# html;
# fastcgi_pass
127.0
.
0.1
:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# fastcgi_params;
First remove the “#” in front, and also replace
root
html; was changed to root D:/wnmp/www;. Then change the /scripts marked in red to "$document_root". The "$document_root" here refers to the site path pointed to by "root". This is the changed version:
# pass the PHP scripts to FastCGI serverlistening
on 127.0.0.1:9000
#
Location ~ .php$ {
root
fastcgi_pass 127.0.0.1:
; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
to start php and start nginx manually. Of course, you can also use a script to achieve this. First, unzip the downloaded RunHiddenConsole.zip package into the nginx directory. The function of RunHiddenConsole.exe is to automatically close the script after executing the command line script, and the process started from the script will not be closed. Then create a script and name it "start_nginx.bat". In this way, our service scripts have been created. Double-click start_nginx.bat and see if there are two nginx.exe processes and one php-cgi.exe process in the process manager? In this way, the nginx service is started, and php is also run in fastCGI mode. Go to the site directory, create a new phpinfo.php file, and edit it phpinfo();?>
Save the configuration file and that’s it.
The nginx php environment has been initially configured, let’s take a look. We can enter the command @<span>echooff
REMWindows 下无效
REM set PHP_FCGI_CHILDREN</span>=5<span>
REM 每个进程处理的最大请求数,或设置为 Windows 环境变量
setPHP_FCGI_MAX_REQUESTS</span>=1000<span>
echo Starting PHPFastCGI...
RunHiddenConsole D:</span>/wnmp/php5/php-cgi.exe -b 127.0.0.1:9000 -cD:/wnmp/php5/php.ini
<span>echo Starting nginx...
RunHiddenConsole D:</span>/wnmp/nginx/nginx.exe -p D:/wnmp/<span>nginx
再另外创建一个名为stop_nginx.bat的脚本用来关闭nginx
</span>@<span>echooff
echo Stoppingnginx...
taskkill </span>/F /IM nginx.exe ><span> nul
echo Stopping PHPFastCGI...
taskkill </span>/F /IM php-cgi.exe ><span> nul
exit</span>
After saving, open the browser and enter "http://localhost/phpinfo.php". If you see
It means that the nginx php environment has been configured, haha~
4.MySQL installation and configuration
(Simple) After downloading the MySQL installation, go to next to install it.