windows7安装php+mysql_在Windows7_x64下搭建Nginx+MySQL+Php环境并安装wordpress - PanpChing

安装MySQL

安装php

588a098f725f8de50ef166634fb796a8.png

和MySQL一样,下载包是一个zip压缩包,只需解压缩即可。将它解压缩到 D:\WNMP\php-5.5.6-Win32-VC11-x64目录下:

5fc956b149f5d43a63522c2d728f315c.png

配置php

将php.ini-production文件复制并重命名为php.ini,并用Notepad++(没有安装此软件的话就使用记事本)打开php.ini:

查找并定位到行

修改为

; extension_dir = “ext”

extension_dir = “ext”

;extension=php_gd2.dll

extension=php_gd2.dll

;extension=php_mbstring.dll

extension=php_mbstring.dll

;extension=php_mysql.dll

extension=php_mysql.dll

;extension=php_mysqli.dll

extension=php_mysqli.dll

;extension=php_pdo_mysql.dll

extension=php_pdo_mysql.dll

;cgi.force_redirect = 1

cgi.force_redirect = 1

;cgi.fix_pathinfo=1

cgi.fix_pathinfo=1

;cgi.rfc2616_headers = 0

cgi.rfc2616_headers = 1

安装Nginx

2748adbb7585c63c3b890477bd81cd37.png

当前可以选择下载稳定版本1.4.3,或者选择最新版本1.5.6,本文选择下载最新版。与php和mysql一样,下载包是一个zip压缩包,将它解压缩到D:\WNMP\nginx-1.5.6目录下:

e76920cf5b383b90b5abb5fef9fe10cd.png

配置Nginx

Nginx的配置文件是在安装目录的conf文件夹下的nginx.conf,并用Notepad++(没有安装此软件的话就使用记事本)打开它:

查找并定位到以下配置:

1

2

3

4

location / {

root   html;

index  index.html index.htm;

}

1

2

3

4

location / {

root   html;

index  index.html index.htm index.php;

}

继续往下查找并定位到以下配置:

1

2

3

4

5

6

7

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

#}

1

2

3

4

5

6

7

location ~ \.php$ {

root           html;

fastcgi_pass   127.0.0.1:9000;

fastcgi_index  index.php;

fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

include        fastcgi_params;

}

创建php-cgi-start.vbs文件,添加以下内容:

1

createobject (

"wscript.shell"

)

.

run "D:\WNMP\php-5.5.6-Win32-VC11-x64\php-cgi.exe -b 127.0.0.1:9000 -c D:\WNMP\php-5.5.6-Win32-VC11-x64\php.ini"

,

0

创建nginx-start.vbs文件,添加以下内容:

1

createobject("wscript.shell").run "D:\WNMP\nginx-1.5.6\nginx.exe",0

创建service-start.bat文件用于启动web服务器,添加以下内容:

1

2

3

4

5

6

echo off;

php-cgi-start.vbs

echo php-cgi started.

Nginx-start.vbs

echo nginx started.

exit;

创建service-stop.bat文件用于关闭web服务器,添加以下内容:

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

以后只需用鼠标双击service-start.bat启动web服务,运行service-stop.bat关闭web服务。

配置完成后Nginx的安装根目录如下:

07d583828a4ad4f3a67a72495b8a72a9.png

安装wordpress

将wordpress压缩包解压到D:\WNMP\nginx-1.5.6\html\目录下(这个目录是我们已配置的nginx默认根目录),并将文件夹重命名为wp,如下:

dcfbff44685716ab7c802b55df1e598e.png

连接mysql数据库创建一个由wordpress专用的数据库:

C:\Windows\System32>mysql -h localhost -u root -p123456

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 5

Server version: 5.5.25-log MySQL Community Server (GPL)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database wordpress;

Query OK, 1 row affected (0.00 sec)

mysql> create user wp_admin@localhost identified by '123456';

Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on wordpress.* to wp_admin;

Query OK, 0 rows affected (0.00 sec)

在浏览器访问:http://localhost/wp即可访问wordpress安装页面(注意:nginx已启动)

04e721ef4b05ca46027d3ec3a59c248f.png

2499a5fb70b9839e010ea68c23ad7f03.png

35582e54cc3caecb09e38e17ff7032fd.png

接下去就跟普通的网上注册一样简单了。

7237129a34c64001f8ff0d810105d353.png

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值