Win+nginx+php+mysql environment configuration, nginxmysql_php Tutorial

Source: Internet
Author: User

Win+nginx+php+mysql environment Configuration, Nginxmysql


1. Preparatory 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

  Directly unzip the downloaded PHP package, to the D disk Wnmp directory (D:\WNMP), here the extracted folder renamed to PHP5. Go to Folder to modify the Php.ini-delelopment file to PHP.ini, and open it with EditPlus or notepad++. Found it

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

Common extension, 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 the front ";"

; cgi.fix_pathinfo=1

; cgi.force_redirect = 1

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

Installation configuration for 3.Nginx

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

1. There are 3 ways to start

(1) Double-click the Nginx.exe icon, the Black window can be seen a flash, the start is complete.

(2) command line to Nginx directory, input nginx boot. (Note that this way the command-line window has no hint and is locked)

(3) command line to Nginx directory, input start Nginx boot, this mode does not lock

2. Modify the configuration to support PHP

    Enter the Nginx conf directory, open the Nginx configuration file nginx.conf, find

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

The root html will be changed to root d:/wnmp/www;

Go down and find

# Pass the PHP scripts to FastCGI serverlistening on127.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 the "#" is removed, the same 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, this is changed:

# Pass the PHP scripts to FastCGI serverlisteningon 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 you're ready.

Nginx+php the environment is initially configured, to run to see. We can enter a command

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

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

  

@echooffremwindows Invalid REM set Php_fcgi_children=5REM The maximum number of requests processed per process, or set to 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 called Stop_nginx.bat to close nginx@  Echooffecho Stoppingnginx   ... /f/im nginx.exe >/f/im php-cgi.exe > nulexit

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

This will start the Nginx service, and PHP will run in a fastcgi manner.

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

   Phpinfo();? >

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

It shows that the nginx+php environment has been configured, hehe ~

4.MySQL Installation and Configuration

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

http://www.bkjia.com/PHPjc/1089435.html www.bkjia.com true http://www.bkjia.com/PHPjc/1089435.html techarticle win+nginx+php+mysql Environment Configuration, Nginxmysql 1. Ready to 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.10M Ysql 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.