windows下没有php-fpm可以使用,但是可以通过xxfpm,可以模拟php-fpm使用,只有32位版本的,但是经过测试,可以在64位windows7旗舰版使用。
php下载地址:php5.3.28非线程安全版
nginx下载地址:nginx1.2.0
xxfpm下载地址(已经包涵pthreadGC2.dll):xxfpm
mysql请自行下载:mysql-32(windows 32位)
mysql-64(windows 64位)
【下载时要登录,如果可以,就自己注册用户。已经注册好的用户:1051292443@qq.com anjiaxin】
ZendGuardLoader下载地址:ZendGuardLoader
测试环境php.ini下载地址:php.ini
测试环境nginx.conf下载地址:nginx.conf
下载nginx,解压即可(测试的时候放在d:\nginx1.2.0目录)
启动时直接运行nginx.exe即可(需要管理员权限)关闭时直接结束进程即可关闭命令:
taskkill /F /IM nginx.exe > nul
下载php非线程安全版非安装版解压即可(测试的时候放在d:\php目录)
请参考其它windows下单机环境部署,无特殊要求,只要本机可以联通即可。
将目录解压缩(主要目标文件是xxfpm.exe和pthreadGC2.dll,测试环境为d:\xxfpm\bin\目录)
若两个文件放在同一目录下,仍提示缺少pthredGC2.dll文件而无法运行,请按照以下步骤注册pthreadGC2.dll文件。将pthreadGC2.dll文件拷贝到windows安装目录\system32\目录下(测试环境为c:\windows\system32)注册pthreadGC2.dll文件(cmd下执行regsvr32 pthreadGC2.dll)
regsvr32 pthreadGC2.dll
启动命令:xxfpm.exe d:/php/php-cgi.exe -n测试环境执行如下命令
xxfpm.exe d:/php/php-cgi.exe -n 5 -p 9000如果需要指定特定的php.ini文件执行以下命令
xxfpm.exe "d:/php/php-cgi.exe -c d:/php/php.ini" -n 5 -p9000
关闭命令:
taskkill /F /IM xxfpm.exe > nul注意:php-cgi.exe在关闭xxfpm.exe的时候也会一起关闭
nginx需要配置如下内容:
fastcgi
pathinfo
php页面支持
#user nobody;
worker_processes 1;
worker_rlimit_nofile 65538;
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
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;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 8080;
server_name localhost;
root d:/www;
charset utf-8;
access_log logs/host.access.log;
location / {
root d:/www;
index index.html index.htm 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 d:/www;
}
location ~ \.php {
include fastcgi_params;
set $path_info "";
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
set $real_script_name $1;
set $path_info $2;
}
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
}
php.ini需要配置内容:
基本支持(时区,pathinfo,GD,mysql等)
date.timezone = prc enable_dl = On cgi.force_redirect = 0 cgi.fix_pathinfo=1 fastcgi.impersonate = 1 cgi.rfc2616_headers = 1 allow_url_fopen = On
extension_dir="e:/php/ext"
extension=php_bz2.dll
extension=php_curl.dll
extension=php_gd2.dll
extension=php_gettext.dll
extension=php_mbstring.dll
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_openssl.dll
extension=php_pdo_mysql.dll
extension=php_sockets.dll
extension=php_xmlrpc.dll
ZendLoader配置:
[Zend.loader] zend_loader.enable=1 zend_loader.disable_licensing=0 zend_loader.obfuscation_level_support=3 zend_loader.license_path=d:\www\doorman\config zend_extension="D:\PHP\ext\ZendLoader.dll"
详细内容请对照测试版php.ini(本文开头部分下载)
配置完成后请将php.ini复制到windows目录下,否则无法解密。
提示如下错误:
Fatal error: Limited-user licenses are not supported when running as CGI in D:\example.com\app\base\kernel.php on line 23没有安装php-fpm导致,windows下用xxfpm代替(请查阅xxfpm安装)
这种错误很难发现,并且发生在安装多个php环境的电脑中。请将所有的php.ini重命名即可(指定固定的php.ini也有一定可能读取别的php.ini)。