Install and configure Nginx php mysql environment on win platform, nginxmysql_PHP tutorial

WBOY
Release: 2016-07-12 09:00:56
Original
901 people have browsed it

Win platform installation and configuration Nginx php mysql environment, nginxmysql

1. Preparation work

(1) PHP version 5.6.17 download address PHP official website Bangkejia download address

(2) Nginx version 1.8.0 download address Nginx official website Bangkejia download address

(3) MySQL version 5.7.10 MySQL official website Bangkejia download address

2.php installation and configuration

Directly decompress the downloaded php package and go to the wnmp directory on drive D (D:wnmp). Here, rename the decompressed folder to php5. Enter the folder and modify the php.ini-delelopment file to php.ini, and open it with Editplus or Notepad. Found

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

Commonly used extensions, remove the leading ";"

  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

Copy after login

nginx supports configuration, remove the leading ";"

;cgi.fix_pathinfo=1

;cgi.force_redirect = 1

;cgi.rfc2616_headers = 0. First remove the semicolon and then change it to cgi.rfc2616_headers = 1

3.Nginx installation configuration

Extract the downloaded package to D:wnmp and directly run nginx.exe in the directory to start.

1. There are 3 startup methods

(1) Double-click the nginx.exe icon, a black window will flash by, and the startup is completed.

(2) Go to the nginx directory from the command line and enter nginx to start. (Note: In this method, the command line window has no prompts and is locked)

(3) Go to the nginx directory from the command line and enter start nginx to start. This method will not lock

 2. Modify the configuration to support PHP

Enter the conf directory of nginx, open the nginx configuration file nginx.conf, and find

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

Copy after login

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

Go further down and 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;
    #}

Copy after login

First remove the “#” in front, and also change root html; to root D:/wnmp/www;. Then change /scripts marked in red to "$document_root". "$document_root" here refers to the site path pointed to by "root". This is the changed version:

    # 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;
    }

Copy after login

Save the configuration file and that’s it.

The nginx php environment has been initially configured, let’s take a look. We can enter the command

to start php and start nginx manually. Of course, you can also use scripts to achieve this.

First, unzip the downloaded RunHiddenConsole.zip package into the nginx directory. The function of RunHiddenConsole.exe is to automatically close the script after executing the command line script, and the process started from the script will not be closed. Then create a script and name it "start_nginx.bat".

@echooff
Invalid under REMWindows
REM set PHP_FCGI_CHILDREN=5

REM The maximum number of requests handled by each process, or set to a 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 shut down nginx

@echooff
echo Stoppingnginx... 
taskkill /F /IM nginx.exe > nul
echo Stopping PHPFastCGI...
taskkill /F /IM php-cgi.exe > nul
exit

Copy after login

In this way, our service scripts have been created. Double-click start_nginx.bat and see if there are two nginx.exe processes and one php-cgi.exe process in the process manager?

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

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

  <&#63;php echo phpinfo();&#63;>
Copy after login

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

It means that the nginx php environment has been configured, haha~

4.MySQL installation and configuration

(Simple) After downloading the MySQL installation, go to next to install it.

Articles you may be interested in:

  • Nginx PHP MySQL dual-machine mutual backup, fully automatic switching solution
  • Nginx 0.7.x PHP 5.2.6 (FastCGI) MySQL 5.1 Configuration optimization on 128M small memory VPS server
  • Windows uses nginx to implement website load balancing test example
  • Installation and configuration method of Nginx PHP5 under Windows
  • CentOS Nginx PHP MySQL Detailed configuration (illustration)
  • Nginx Windows load balancing configuration method
  • Sharing the configuration method of enabling phpinfo mode function of nginx under linux(centos5.5)/windows
  • CentOS 6.4 installation Configuring LNMP server (Nginx PHP MySQL)
  • Illustration of installation steps of nginx deployment on windows (reverse proxy and load balancing)

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1091102.htmlTechArticleWin platform installation and configuration Nginx php mysql environment, nginxmysql 1. Preparation (1) PHP version 5.6.17 download address PHP official website Bangkejia download address (2) Nginx version 1.8.0 download address Nginx official...
Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template