Win platform Installation configuration Nginx+php+mysql Environment _php instance

Source: Internet
Author: User
Tags ini mysql version php website phpinfo

1. Preparatory work

(1) PHP version 5.6.17 download address PHP website Cloud habitat Download address

(2) Nginx version 1.8.0 download address Nginx website Cloud Habitat download address

(3) MySQL version 5.7.10 MySQL website cloud habitat Community download address

2.php Installation and Configuration

Download the good PHP package directly, to D disk Wnmp directory (D:\WNMP), where the extracted folder renamed to PHP5. Enter the folder to modify the Php.ini-delelopment file to php.ini and open it with EditPlus or notepad++. Found it

Extension_dir = "ext" Change to Extension_dir = "D:/wnmp/php5/ext"

Common extensions, remove the front ";"

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 support configuration, remove front ";"

; cgi.fix_pathinfo=1

; cgi.force_redirect = 1

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

3.Nginx installation Configuration

Unzip the downloaded package to D:\WNMP, run directly under Nginx.exe boot.

1. Starting mode has 3 kinds

(1) Double-click the Nginx.exe icon, visible Black window flashed past, started.

(2) command line to Nginx directory, enter Nginx boot. (note, this way the command line window is not prompted and locked)

(3) command line to Nginx directory, enter start Nginx start, this way does not lock

2. Modify configuration to support PHP

Enter Nginx's conf directory, open nginx configuration file nginx.conf, find

Location/{
   root  html; #这里是站点的根目录
   index index.html index.htm index.php;
}

Change root HTML to root d:/wnmp/www;

Go down and find

# Pass the PHP scripts to FastCGI serverlistening on 127.0.0.1:9000
#
#location ~ \.php$ {
#  R    Oot      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 the "#" in front of it, and also change the root HTML to root d:/wnmp/www; Then the marked red/scripts changed to "$document _root", where the "$document _root" refers to the previous "root" refers to the site path, which is changed after:

# Pass the PHP scripts to FastCGI serverlistening on 127.0.0.1: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 and it's OK.

nginx+php environment on the preliminary configuration well, to run and see. We can enter the command

To start PHP, and manually start Nginx, of course, you can also use the script to implement.

First of all, the download of the Runhiddenconsole.zip package into the Nginx directory, RunHiddenConsole.exe is the role of the command line after the execution of the script can automatically close the script, and the process opened from the script is not closed. Then create the script, named "Start_nginx.bat".

@echooff
Invalid under Remwindows
REM Set php_fcgi_children=5

REM the maximum number of requests processed per process, or set as 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 close the Nginx

@echooff
echo Stoppingnginx 
... taskkill/f/im nginx.exe > Nul
echo stopping phpfastcgi ...
taskkill/f/im php-cgi.exe > Nul
exit

In this way, our service scripts are also created. Double-click Start_nginx.bat to see if the process manager has two nginx.exe processes and a php-cgi.exe process?

The Nginx service starts, and PHP runs in a fastcgi way.

To the Site directory, create a new phpinfo.php file, edit it inside

<?php echo phpinfo ();? >

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

On the description, nginx+php environment has been configured well, hehe ~

4.MySQL Installation and Configuration

(abbreviated) MySQL installation download, all the way next installation.

Related Article

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.