phpcms环境检测MySQL_WNMP nginx+php5+mysql测试环境安装(Windows7)(一)

(更新中.. 软件安装在D:\webserver下,网站根目录D:\webroots)

1. 安装php

这里下载PHP 5.2 (5.2.13)版本的VC6 x86 Non Thread Safe (2010-Feb-24 15:38:53) ZIP [9.95MB]

(最新的版本5.3.2一些软件不支持,比如下面的Zend Optimizer)

Notes:php版本选择

a.VC6版本是使用Visual Studio 6编译器编译的,如果你的php是用Apache来架设,就选择vc6版本;VC9版本是使用Visual Studio 2008编译器编译的,如果你的php使用IIS来架设的,就选择vc9版本

b.PHP的两种执行方式:ISAPI和FastCGI。ISAPI执行方式是以DLL动态库的形式使用,可以在被用户请求后执行,在处理完一个用户请求后不会马上消失,所以需要进行线程安全检查,这样来提高程序的执行效率,所以如果是以ISAPI来执行PHP,建议选择Thread Safe版本;而FastCGI执行方式是以单一线程来执行操作,所以不需要进行线程的安全检查,除去线程安全检查的防护反而可以提高执行效率,所以,如果是以FastCGI来执行PHP,建议选择Non Thread Safe版本。

解压缩至D:\webserver\php-5.2.13\

复制一份php.ini-recommended,更名为php.ini。查找下面几项,更改php.ini配置:其中extension_dir指定扩展位置;

error_reporting = E_ALL

display_errors = On

extension_dir = "D:\webserver\php-5.2.13\ext"

doc_root =

cgi.fix_pathinfo = 1

doc_root默认为空,不要指定,否则提示"No input file specified"

最后一句解除注释,允许修正地址,nginx将php请求交与Fast CGI Server处理

(尚未开启mysql和pdo)

2. 安装nginx

这里也下载了最新的nginx/Windows-0.8.36

解压缩至D:\webserver\nginx-0.8.36

将conf\nginx.conf配置如下:

8f900a89c6347c561fdf2122f13be562.png

961ddebeb323a10fe0623af514929fc1.png

#user nobody;

worker_processes 1;

#error_log logs/error.log;

#error_log logs/error.log notice;

#error_log logs/error.log info;

#pid logs/nginx.pid;

events {

worker_connections 64;

}

http {

include mime.types;

default_type application/octet-stream;

#log_format main '$remote_addr - $remote_user [$time_local] "$request" '

# '$status $body_bytes_sent "$http_referer" '

# '"$http_user_agent" "$http_x_forwarded_for"';

#access_log logs/access.log main;

sendfile on;

#tcp_nopush on;

#keepalive_timeout 0;

keepalive_timeout 65;

#gzip on;

server {

listen 80;

server_name localhost;

charset utf-8;

#access_log logs/host.access.log main;

location / {

root D:\webroot;

index index.html index.php;

autoindex on;

}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html

#

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root html;

}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80

#

#location ~ \.php$ {

# proxy_pass http://127.0.0.1;

#}

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

#

location ~ \.php$ {

# root D:/webroot;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME D:/webroot$fastcgi_script_name;

include fastcgi_params;

}

# deny access to .htaccess files, if Apache's document root

# concurs with nginx's one

#

#location ~ /\.ht {

# deny all;

#}

}

# another virtual host using mix of IP-, name-, and port-based configuration

#

#server {

# listen 8000;

# listen somename:8080;

# server_name somename alias another.alias;

# location / {

# root html;

# index index.html index.htm;

# }

#}

# HTTPS server

#

#server {

# listen 443;

# server_name localhost;

# ssl on;

# ssl_certificate cert.pem;

# ssl_certificate_key cert.key;

# ssl_session_timeout 5m;

# ssl_protocols SSLv2 SSLv3 TLSv1;

# ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;

# ssl_prefer_server_ciphers on;

# location / {

# root html;

# index index.html index.htm;

# }

#}

}

其中

worker_processes 1;只默认开启一个进程

work_connections 64;测试服务器的话,一个进程允许64个最大连接数就可以了

server中listen 80;常与IIS冲突,在logs\error.log中会看到如下提示:

2010/05/03 23:22:02 [emerg] 3492#5004: bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket in a way forbidden by its access permissions)

解决办法最好关闭IIS或更改掉IIS开启的端口

location / 指定网站根目录

添加autoindex on;允许目录结构查看

在location ~ \.php$中修改nginx,将php请求转发给PHP FastCGI Server.

这里SCRIPT_FILENAME路径最好使用/,防止用\被解析为特殊字符,如\t是制表符

3. 开启关闭nginx

开启:

在php-5.3.2目录下新建bat如下,开始php-cgi,开启后任务管理器能看到php-cgi.exe

php-cgi -b 127.0.0.1:9000

php-cig这个dos窗口需要长开着,如果需要隐藏可以去这里下载一个小软件

然后双击nginx.exe,任务管理器能看到nginx.exe

在D:\webroot目录下新建index.php

关闭:

新建bat如下

taskkill /F /IM nginx.exe > nul

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值