下载

  1. mysql-5.7.12  http://dev.mysql.com/downloads/mysql  

    nginx-1.10.0  http://nginx.org/en/download.html 

    php-5.6.21     http://php.net/downloads.php 

 

安装

  1. mysql安装 我安装的v6.5 百度一下就知道

  2. nginx安装

  • 解压nginx到指定目录

  • win+r  打开运行输入cmd

    wKioL1cymrjDn68eAABe3KyG4yY245.png

  • 进入到nginx解压目录,使用start nginx.exe 安装nginx

     wKioL1cym4uSQqylAAAF-igHvXw185.png

  • 安装基本就是毫秒级的安装完成后,在浏览器输入127.0.0.1会出现nginx的欢迎界面

wKioL1cym6TB71SOAABjBPJeDLA210.png

  • nginx 的常用命令

         nginx.exe -s stop      //停止nginx

         nginx.exe -s reload   //重新加载nginx

         nginx.exe -s quit       //退出nginx


   3. php安装 

  • 解压安装包到指定安装目录

  • 复制 D:\services-nmp\php\php-5.6.21 目录下的php.ini-development 并重命名为php.ini

  • 打开php.ini 修改配置

    extension_dir 修改为  extension_dir = "D:/services-nmp/php/ext/" 注意斜杠 /   (php的安装路径)

      date.timezone 修改为  date.timezone = Asta/BeiJing

      enable_dl (是否使dl()有效) 修改为  enable_dl = On

      cgi.force_redirect = 1  修改为  cgi.force_redirect = 0 

      fastcgi.impersonate  修改为  fastcgi.impersonate = 1

      cgi.rfc2616_headers  修改为  cgi.rfc2616_headers = 1

      打开mysql 扩展 : 去掉  extension=php_mysql.dll   extension=php_mysqli.dll 前面的分号


配置 使用nginx访问php还需需要配置nginx

  1.  打开nginx的安装目录下的conf 下的nginx.cof

  2.  修改 location / {                                          
               root   html;
               index  index.html index.htm;
            }

     为  location / {
                root   D:/services-nmp/nginx\nginx-1.10.0/html;   
                index  index.html index.htm  index.php;
            }

    3. 修改

        # pass the PHP scripts to FastCGI server listening 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;
        #}

       

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000  
        location ~ \.php$ {
            root               D:/services-nmp/nginx\nginx-1.10.0/html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
    4、保存配置,重启nginx


验证php是否安装成功

     1、执行cgi  下载RunHiddenConsole 随便一搜就有 放到php的安装目录下然后cmd在php目录下执行如下命令

    wKioL1cynArBx9bQAAAGPYD516g815.png

     2、重启nginx

     3、在nginx安装目录下的html文件夹下添加新的php程序 随便写个php程序就行

          <?php
                  phpinfo();
            ?>

     4、在浏览器中访问127.0.0.1/1.php 出现如下界面表示成功。

wKiom1cymzmQZW0hAACCHSXmjR0247.png