windows下配置nginx1.9.x+php7开发环境

星期四, 2016-02-04 | Author: Lee | php | 3,805 views

还是跑不掉在windows下配置对应的开发环境,准备:

1.下载对应的软件
nginx-1.9.10/Windows-1.9.10

PHP 7.0 (7.0.3)/php-7.0.3-nts-Win32-VC14-x86.zip

2.安装配置nginx和php

分别解压到 D:/web/nginx-1.9.10/ 和D:/web/php7/
修改php.ini-recommended文件为php.ini

打开 一堆扩展尽量打开这里示例2个

1
2
3
 extension_dir = "D:/web/php7/ext"
 extension=php_mysqli.dll
 cgi.fix_pathinfo=1  ##这个启用cgi核心关键

nginx.cnf 打开php支持 同时修改fastcgi_param 参数由/scripts$fastcgi_script_name; 修改为$document_root$fastcgi_script_name;

1
2
3
4
5
6
7
8
9
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
      root           D:/web/www;
      fastcgi_pass   127.0.0.1:9000;
      fastcgi_index  index.php;
      fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
      include        fastcgi_params;
}

3.编辑php的脚本 (phpinfo.php)

<?php
    phpinfo();
?>

4.启动和关闭的脚本文件
启动脚本文件 start_nginx.bat

1
2
3
4
5
6
7
8
9
10
@echo off
echo starting nginx...
D:
cd D:/web/nginx-1.9.10/
start nginx
echo starting PHP FastCGI...
D:
cd D:/web/php7/
php-cgi.exe -b 127.0.0.1:9000 -c D:/web/php7/php.ini
exit

关闭脚本文件 stop_nginx.bat

1
2
3
4
5
6
@echo off
echo Stopping nginx...  
taskkill /F /IM nginx.exe > nul
echo Stopping PHP FastCGI...
taskkill /F /IM php-cgi.exe > nul
exit

搞定配置

Tags: ,

文章作者: Lee

本文地址: https://www.pomelolee.com/1539.html

除非注明,Pomelo Lee文章均为原创,转载请以链接形式标明本文地址

No comments yet.

Leave a comment

Search

文章分类

Links

Meta