Win + Nginx + php + mysql environment configuration, nginxmysql_PHP tutorial

Source: Internet
Author: User
Win + Nginx + php + mysql environment configuration, nginxmysql. Win + Nginx + php + mysql environment configuration, nginxmysql1. preparations (1) PHP version 5.6.17PHP official website (2) Nginx version 1.8.0Nginx official website (3) mySQL 5.7.10MySQL official website win + Nginx + php + mysql environment configuration, nginxmysql

1. preparations

(1) PHP 5.6.17 PHP official website

(2) Nginx 1.8.0 official Nginx website

(3) MySQL 5.7.10 official website

2. install and configure php

 Directly decompress the downloaded php package to the wnmp Directory (D: \ wnmp) on the D drive. here, rename the decompressed folder to php5. Go to 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"

Common extensions, remove the previous ";"

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 preceding ";"

; Cgi. fix_pathinfo = 1

; Cgi. force_redirect = 1

; Cgi. rfc2616_headers = 0 first go to the front semicolon and then change to cgi. rfc2616_headers = 1

3. install and configure Nginx

Decompress the downloaded package to D: \ wnmpand directly run nginx.exe in the directory to start.

1. there are three startup methods

(1)double-click the nginx.exe icon. the black window flashed through and started.

(2) run the command line to the nginx directory and enter nginx to start. (Note: the command line window in this mode has no prompt and is locked)

(3) run the command line to the nginx directory and enter start nginx to start. this mode is not locked.

2. support for PHP configuration modification

Go to the nginx conf Directory, open the nginx configuration file nginx. conf, and find

Location /{
Root html; # the root directory of the site
Index index.html index.htm index. php;
}

Change root html; to root D:/wnmp/www;

Next, find

# Pass the PHP scripts to FastCGI serverlistening on 127.0.0.1: 9000
#
# Location ~ \. Php $ {
# Root html;
# Fastcgi_pass 127.0.0.1: 9000;
# Fastcgi_index index. php;
# Fastcgi_param SCRIPT_FILENAME/scripts $ fastcgi_script_name;
# Include fastcgi_params;
#}

First remove "#" and change root html; to root D:/wnmp/www ;. Change the/scripts marked in red to "$ document_root". here, "$ document_root" refers to the site path referred to by "root". this is changed:

# Pass the PHP scripts to FastCGI serverlisteningon fig: 9000
#
Location ~ \. Php $ {
Root D:/wnmp/www;
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;
Include fastcgi_params;
}

  

Save the configuration file.

The nginx + php environment has been initially configured. We can enter the command

To start php and manually start nginx. of course, you can also use the script.

First, decompress the downloaded runhiddenconsole.zippackage to the nginxdirectory. runhiddenconsole.exe automatically closes the script after executing the command script, but the processes enabled from the script are not disabled. Create a script named "start_nginx.bat ".

  

@ EchooffREMWindows: invalid REM set PHP_FCGI_CHILDREN = 5REM maximum number of requests processed by each process, or set it to the Windows environment variable setPHP_FCGI_MAX_REQUESTS = 1000 echo Starting PHPFastCGI... runHiddenConsole D:/wnmp/php5/php-cgi.exe-B 127.0.0.1: 9000-cD:/wnmp/php5/php. ini

Echo Starting nginx... runHiddenConsole D:/wnmp/nginx/nginx.exe-p D:/wnmp/nginx create another script named stop_nginx.bat to disable nginx @ echooffecho Stoppingnginx... taskkill/F/IM nginx.exe> nulecho Stopping PHPFastCGI... taskkill/F/IM php-cgi.exe> nulexit

In this way, all our service scripts have been created. Double-click start_nginx.batto check whether the process manager has two nginx.exepaths and a php-cgi.exe process?

In this way, the nginx service is started and php runs in fastCGI mode.

Go to the site directory, create a phpinfo. php file, and edit it in it.

  

After saving, open the browser and enter "http: // localhost/phpinfo. php". if you see

The nginx + php environment has been configured ~

4. install and configure MySQL

(Simple) install and download MySQL, one way to install next.

Http://www.bkjia.com/PHPjc/1089435.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/1089435.htmlTechArticlewin+Nginx+php+mysql environment configuration, nginxmysql 1. preparation (1) PHP version 5.6.17 PHP official website (2) Nginx version 1.8.0 Nginx official website (3) MySQL version 5.7.10MySQL official website...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.