Php environment setup-WNMP (Win7 + NGINX + MYSQL + PHP)

Source: Internet
Author: User
Tags php development environment
Php environment setup-WNMP (Win7 + NGINX + MYSQL + PHP) [introduction]


The php development environment should be the same as breathing for every phper, and should not be very difficult. Next, I will teach you how to build a php environment, which is also my own summary. I hope to improve it with you. (I hope you will not share it with others. do not hide it privately)


[Preparations]


At the beginning of preparation, first check how many operating systems My computer is (don't ask du Niang). My computer is a 64-bit Win7 operating system. I will take 64-bit as an example.

Php version: php-5.6.15-Win32-VC11-x64.zip php

Nginx: nginx-1.8.0.zip nginx1.80

Mysql: mysql-5.6.27-winx64.zip mysql

Create an environment directory. I personally like to place the environment items on disk D. therefore, create "wnmp" under the Directory D. create four folders in the directory. 1. mysql 2. nginx3.web 4.php


[Installation environment]


1. nginx

Decompress the downloaded nginx-1.8.0.zip file to D: \ wamp \ nginx.

2. php

Download php-5.6.15-win32-vc11-x64.zip and decompress it to D: \ wamp \ php.

3. mysql

Decompress the downloaded php-5.6.15-win32-vc11-x64.zip file to D: \ wamp \ mysql

[Configure the environment]

1. php configuration

Sort again in another day

2. nginx configuration

Sort again in another day

3. mysql installation-free configuration

Decompress php-5.6.15-win32-vc11-x64.zip to d:/wamp/mysql

Copy the default file my-default.ini in the extracted Directory, rename my. ini, and copy the following information to my. ini

**************************************** **************************************** **************************************** ****************

[Client]
Port = 3306
Default-character-set = utf8
[Mysqld]
Port = 3306
Character_set_server = utf8
Basedir = D: \ wamp \ mysql
# Decompress the Directory
Datadir = D: \ wamp \ mysql \ data
# Decompress the data directory in the directory
SQL _mode = NO_ENGINE_SUBSTITUTION, STRICT_TRANS_TABLES
[WinMySQLAdmin]
D: \ wamp \ mysql \ bin \ mysqld.exe

**************************************** **************************************** **************************************** *****************

4. add environment variables

The procedure is as follows:
1) right-click my computer-> Properties-> Advanced system settings (advanced)-> environment variables
Click New Under system variables
Input variable name: MYSQL_HOME
Input variable value: D: \ wnmp \ mysql
# This is the custom extract directory of mysql.
2) select the Path in the system variable
Click edit
Add the variable value % MYSQL_HOME % \ bin to the variable value.
Note that this variable is added after the original variable value and separated by;. the original variable value cannot be deleted,

5. run cmd to enter D:/wamp/mysql/bin to install the mysql system service. after the installation is successful, the system prompts that the service is successfully installed.

Install the service command: mysqld install MySQL -- defaults-file = "D: \ wnmp \ mysql \ my. ini"

# The Command for removing a service is mysqld remove.

[Startup environment]

1. create the file start_gbk_server.bat

@ Echo off & title start the Nginx server
Color 0A
Invalid in REM Windows
REM set PHP_FCGI_CHILDREN = 5
Call stop_server.bat
REM the maximum number of requests processed by each process, or set it to a Windows environment variable
Sets PHP_FCGI_MAX_REQUESTS = 1000
Echo start php-5.4.19 FastCGI...
RunHiddenConsole.exe D:/wnmp/php/php-cgi.exe-B 127.0.0.1: 9000-c "D:/wnmp/php. ini"
Echo starts Nginx 1.6.3
RunHiddenConsole.exe D:/wnmp/nginx/nginx.exe-p D:/wnmp/nginx
Echo starts Mysql 5.6
RunHiddenConsole.exe net start mysql
Echo startup completed...

2. create the stop_bgk_server.bat file.

@ Echo off & title Nginx
Color 0A
Echo Stopping Nginx...
Taskkill/F/IM nginx.exe> nul
Echo Stopping PHP FastCGI...
Taskkill/F/IM php-cgi.exe> nul
Echo Stopping Mysql
Net stop mysql

[Test environment]

Create index. php in the directory D:/wnmp/web as follows:

Phpinfo ();

?>

Find the hosts file in the west of C: \ Windows \ System32 \ drivers \ etc and open it in Notepad and write the following hosts:
# Localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
#: 1 localhost
127.0.0.1 www.example.com

Open www.example.com in the browser.

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.