php_ming.dll 5.3.10.0,[问题解决]Windows 10 + Nginx1.10.3 + MySQL5.5.20 + PHP5.6.31

1.下载

NGINX-1.10.3官网下载:http://nginx.org/en/download.html

PHP5.6.31版本下载地址:http://windows.php.net/download/

Mysql5.5.20版本下载地址:http://www.mysql.com/downloads/mysql/

2.安装Mysql

配置时用户名root,密码root,字符编码utf8,utf8_general_ci

3.解压NGINX和PHP到安装位置

这里我在D盘新建一个文件夹:WNMP(windows,ngnix,mysql,php),把下面的软件安装到这个文件夹里面。

NGINX目录D:\WNMP\nginx

PHP目录D:\WNMP\php

4.安装nginx

(1).打开D:\WNMP\nginx目录,运行该文件夹下的nginx.exe

(2).测试是否启动nginx。打开浏览器访问http://localhost,

是否出现“Welcome to nginx!”,出现的证明已经启动成功了。没有启动的话,看看80端口有没有被占用。

注意:该网站的默认目录在“D:\WNMP\nginx\html”下

5.安装php(这里主要讲nginx配置启动php,以cgi运行php)

(1).修改nginx配置文件是D:\WNMP\nginx\conf\nginx.conf

1.location / {

2. root html;

3. index index.html index.htm;

4.}

更改root目录,添加index.php

1.location / {

2. root D:/WNMP/nginx/html;

3. index index.html index.htm index.php;

4.}

1.# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

2.#

3.#location ~ \.php$ {

4.# root html;

5.# fastcgi_pass 127.0.0.1:9000;

6.# fastcgi_index index.php;

7.# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;

8.# include fastcgi_params;

9.#}

更改root目录,更改/scripts为$document_root(去掉#)

1.# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

2.#

3.location ~ \.php$ {

4. root D:/WNMP/nginx/html;

5. fastcgi_pass 127.0.0.1:9000;

6. fastcgi_index index.php;

7. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

8. include fastcgi_params;

9.}

(2)更改php目录下的php.ini-development,将文件名改为php.ini,进行如下配置

搜索“extension_dir”,找到: e;xtension_dir = "ext" 先去前面的分号再改为 extension_dir = "D:\WNMP\php\ext"

搜索“date.timezone”,找到:;date.timezone = 先去前面的分号再改为 date.timezone = Asia/Shanghai

搜索“enable_dl”,找到:enable_dl = Off 改为 enable_dl = On

搜索“cgi.force_redirect” ;cgi.force_redirect = 1 先去前面的分号再改为 cgi.force_redirect = 0

搜索“fastcgi.impersonate”,找到: ;fastcgi.impersonate = 1 去掉前面的分号

搜索“cgi.rfc2616_headers”,找到:;cgi.rfc2616_headers = 0 先去前面的分号再改为 cgi.rfc2616_headers = 1

搜索“php_mysql”,找到:”extension=php_mysql.dll和extension=php_mysqli.dll 去掉前面的“;”extension=php_mysql.dll和extension=php_mysqli.dll (支持MYSQL数据库)

6.运行

(1).编辑info.php内容如下,放到D:\WNMP\nginx\html目录

phpinfo();

?>

(2).切换到php目录,执行如下命令运行php,如果出现找不到msvcr110.dll的情况,请自行下载安装VC++2012运行库

1.D:

2.cd D:\WNMP\php

3.php-cgi.exe -b 127.0.0.1:9000-c D:\WNMP\php\php.ini

(3).切换到nginx目录,重启nginx.exe

1.D:

2.cd D:\WNMP\nginx

3.nginx -s reload

(4).浏览器访问http://127.0.0.1/info.php

7.测试mysql

(1).编辑sqltest.php内容如下,放到D:\WNMP\nginx\html目录

$link = new mysqli('localhost', 'root', 'root');

if(!$link) echo "FAILD!";

else echo "OK!";

?>

(2)浏览器访问http://127.0.0.1/sqltest.php

8.附:nginx常用命令

nginx -s stop 强制关闭

nginx -s quit 安全关闭

nginx -s reload 改变配置文件的时候,重启nginx工作进程,来时配置文件生效

nginx -s reopen 打开日志文件

9.配置添加nginx为系统服务

下载RunHiddenConsole.exe (下载链接:https://pan.baidu.com/s/1c2Ja3AC 密码:4vbp)并将其放在nginx文件夹下。

在nginx目录下新建两个.bat文件,分别命名为'nginx_start.bat','nginx_stop.bat'

nginx_start.bat内容:

@echo off

REM Windows 下无效

REM set PHP_FCGI_CHILDREN=5

REM 每个进程处理的最大请求数,或设置为 Windows 环境变量

set PHP_FCGI_MAX_REQUESTS=1000

echo Starting PHP FastCGI...

RunHiddenConsole D:/wanmp/php-5.3.8/php-cgi.exe -b 127.0.0.1:9000 -c D:/wanmp/php-5.3.8/php.ini

echo Starting nginx...

RunHiddenConsole D:/wanmp/nginx1.10.3/nginx.exe -p D:/wanmp/nginx1.10.3

nginx_stop.bat内容:

@echo off

echo Stopping nginx...

taskkill /F /IM nginx.exe > nul

echo Stopping PHP FastCGI...

taskkill /F /IM php-cgi.exe > nul

把nginx目录添加到环境变量path下,以后可以在后台输入nginx_start和nginx_stop来开启和关闭服务器,注意eclipse和niginx的默认端口都是9000,建议先开启nginx在开启nginx,当然你可以把nginx的端口改为其他。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值