Table of Contents
Configure wnmp under windows, configure wnmp under windows
Home Backend Development PHP Tutorial Configure wnmp under windows, configure wnmp under windows_PHP tutorial

Configure wnmp under windows, configure wnmp under windows_PHP tutorial

Jul 12, 2016 am 08:52 AM
windows Down try Configuration

Configure wnmp under windows, configure wnmp under windows

Recently tried to configure nginx php mysql under windows, summarize it here.

1. Download the windows version of nginx. Official website download address: http://nginx.org/en/download.htm. After downloading, extract it to D:wnmp

​2. Configure php

Download the windows version of php, official website download address: http://windows.php.net/download/, php will run in cgi mode, unzip the downloaded php package, and go to the wnmp directory of the D drive (D :wnmp), rename the extracted folder to php5.

Enter the folder and modify the php.ini-development file to php.ini​.

Open php.ini and find the following code

extension_dir =<span>"</span><span>./ext</span><span>"</span>更改为extension_dir =<span>"</span><span>D:/wnmp/php5/ext</span><span>"</span>。  <br />;extension=php_mysql.dll 去掉分号<br />;extension=php_mysqli.dll 去掉分号(打开数据库动态链接库)
Copy after login

Then copy the libmysql.dll file in the php5 directory to the C:Windows directory, or set the environment variable path, and then find the following code

;cgi.fix_pathinfo=0 去掉分号并改为 cgi.fix_pathinfo=<span>1</span>
Copy after login

3. Configure nginx

After decompression, open the nginx.conf file in the conf directory and find

        location /<span> {
            root   html;
            index  index.html index.htm;
        }
        #error_page  </span><span>404</span>              /<span>404</span><span>.html;
        # redirect server error pages to the </span><span>static</span> page /<span>50x.html
        #
        error_page   </span><span>500</span> <span>502</span> <span>503</span> <span>504</span>  /<span>50x.html;
        location </span>= /<span>50x.html {
            root   html;
        }
        # proxy the PHP scripts to Apache listening on </span><span>127.0</span>.<span>0.1</span>:<span>80</span><span>
        #
        #location </span>~<span> \.php$ {
        #    proxy_pass   http:</span><span>//</span><span>127.0.0.1;</span>
<span>        #}
        # pass the PHP scripts to FastCGI server listening on </span><span>127.0</span>.<span>0.1</span>:<span>9000</span><span>
        #
        #location </span>~<span> \.php$ {
        #    root           html;
        #    fastcgi_pass   </span><span>127.0</span>.<span>0.1</span>:<span>9000</span><span>;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  </span>/<span>scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}</span>
Copy after login

changed to:

        location /<span> {
            root   <span>d:/www</span>;  //自行设置目录
            index  index.html index.htm;
        }
        error_page  </span><span>404</span>              /<span>404</span><span>.html;
         redirect server error pages to the </span><span>static</span> page /<span>50x.html
        #
        error_page   </span><span>500</span> <span>502</span> <span>503</span> <span>504</span>  /<span>50x.html;
        location </span>= /<span>50x.html {
            root   <span>d:/www</span>;
        }
         proxy the PHP scripts to Apache listening on </span><span>127.0</span>.<span>0.1</span>:<span>80</span><span>
        
        location </span>~<span> \.php$ {
            proxy_pass   http:</span><span>//</span><span>127.0.0.1;</span>
<span>        }
         pass the PHP scripts to FastCGI server listening on </span><span>127.0</span>.<span>0.1</span>:<span>9000</span><span>
        
        location </span>~<span> \.php$ {
            root           <span>d:/www</span>;
            fastcgi_pass   </span><span>127.0</span>.<span>0.1</span>:<span>9000</span><span>;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  <span>$document_root</span></span><span>$fastcgi_script_name;
            include        fastcgi_params;
        }</span>
Copy after login

Save configuration file.

4. Run nginx and php

Enter command:

D:\wnmp\php5>php-cgi.exe -b <span>127.0</span>.<span>0.1</span>:<span>9000</span> -c D:/wnmp/php5/php.ini
Copy after login

Run php in cgi mode and listen to the data sent by nginx from port 9000. Double-click nginx.exe to run nginx.

Quick startup settings: First download the file RunHiddenConsole.exe and put it into the nginx directory, then save the following code as start_nginx.bat

<span>@echo off  
</span><span>set</span> php_home=../php5/
<span>set</span> nginx_home=./<span>
echo Starting PHP FastCGI...  
RunHiddenConsole </span>%php_home%/php-cgi.exe -b <span>127.0</span>.<span>0.1</span>:<span>9000</span> -c %php_home%/<span>php.ini  
echo Starting nginx...  
RunHiddenConsole </span>%nginx_home%/nginx.exe -p %nginx_home%<span>
exit</span>
Copy after login

Save the following code as stop_nginx.bat

<span>@echo off  
echo Stopping nginx...    
taskkill </span>/F /IM nginx.exe ><span> nul  
echo Stopping PHP FastCGI...  
taskkill </span>/F /IM php-cgi.exe ><span> nul  
exit</span>
Copy after login

The final file looks like this. Double-click start_nginx.bat to start nginx and php.

5. Install and configure mysql Download mysql: http://dev.mysql.com/downloads/mysql/, and then extract it to the D:/mnmp directory Found in my-default.ini
basedir=<span>C:\Program Files\MySQL\ </span>去掉#<span>(mysql所在目录)<br />datadir</span>=C:\Program Files\MySQL\data 去掉#(mysql所在目录\data)
Copy after login

Command line to enter the directory: cd C:Program FilesMySQLbin, enter the following command to install mysql: mysqld -install (can be found in the service after installation)

Start the service: net start mysql, close the service: net stop mysql. It can also be started or shut down in the service.

Add path variable: Add in Computer>Properties>Advanced System Settings>Environment Variables: F:phpenvmysqlbin Login command: mysql -h host ip -u username -p user password ​

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1126846.htmlTechArticleConfiguring wnmp under windows, configuring wnmp under windows. I recently tried to configure nginx php mysql under windows. Let’s summarize it here. 1. Download the windows version of nginx, official website download address: http://ngi...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Can I install mysql on Windows 7 Can I install mysql on Windows 7 Apr 08, 2025 pm 03:21 PM

Yes, MySQL can be installed on Windows 7, and although Microsoft has stopped supporting Windows 7, MySQL is still compatible with it. However, the following points should be noted during the installation process: Download the MySQL installer for Windows. Select the appropriate version of MySQL (community or enterprise). Select the appropriate installation directory and character set during the installation process. Set the root user password and keep it properly. Connect to the database for testing. Note the compatibility and security issues on Windows 7, and it is recommended to upgrade to a supported operating system.

How to speed up the loading speed of PS? How to speed up the loading speed of PS? Apr 06, 2025 pm 06:27 PM

Solving the problem of slow Photoshop startup requires a multi-pronged approach, including: upgrading hardware (memory, solid-state drive, CPU); uninstalling outdated or incompatible plug-ins; cleaning up system garbage and excessive background programs regularly; closing irrelevant programs with caution; avoiding opening a large number of files during startup.

How to pull the vertical reference line of PS How to pull the vertical reference line of PS Apr 06, 2025 pm 08:18 PM

Pull vertical guides in Photoshop: Enable ruler view (View &gt; ruler). Hover the mouse over the vertical edge of the ruler, and then the cursor becomes a vertical line with double arrows and hold and drag the mouse to pull out the reference line. Click Delete by dragging the guide, or hovering it into a cross.

How to solve mysql cannot connect to local host How to solve mysql cannot connect to local host Apr 08, 2025 pm 02:24 PM

The MySQL connection may be due to the following reasons: MySQL service is not started, the firewall intercepts the connection, the port number is incorrect, the user name or password is incorrect, the listening address in my.cnf is improperly configured, etc. The troubleshooting steps include: 1. Check whether the MySQL service is running; 2. Adjust the firewall settings to allow MySQL to listen to port 3306; 3. Confirm that the port number is consistent with the actual port number; 4. Check whether the user name and password are correct; 5. Make sure the bind-address settings in my.cnf are correct.

Unable to access mysql from terminal Unable to access mysql from terminal Apr 08, 2025 pm 04:57 PM

Unable to access MySQL from the terminal may be due to: MySQL service not running; connection command error; insufficient permissions; firewall blocks connection; MySQL configuration file error.

Solutions to the errors reported by MySQL on a specific system version Solutions to the errors reported by MySQL on a specific system version Apr 08, 2025 am 11:54 AM

The solution to MySQL installation error is: 1. Carefully check the system environment to ensure that the MySQL dependency library requirements are met. Different operating systems and version requirements are different; 2. Carefully read the error message and take corresponding measures according to prompts (such as missing library files or insufficient permissions), such as installing dependencies or using sudo commands; 3. If necessary, try to install the source code and carefully check the compilation log, but this requires a certain amount of Linux knowledge and experience. The key to ultimately solving the problem is to carefully check the system environment and error information, and refer to the official documents.

MySQL can't be installed after downloading MySQL can't be installed after downloading Apr 08, 2025 am 11:24 AM

The main reasons for MySQL installation failure are: 1. Permission issues, you need to run as an administrator or use the sudo command; 2. Dependencies are missing, and you need to install relevant development packages; 3. Port conflicts, you need to close the program that occupies port 3306 or modify the configuration file; 4. The installation package is corrupt, you need to download and verify the integrity; 5. The environment variable is incorrectly configured, and the environment variables must be correctly configured according to the operating system. Solve these problems and carefully check each step to successfully install MySQL.

See all articles