1.将PHP升级为5.6,但是需要做好IIS和PHP的配置,因为IIS还承担了其他几个Web项目的运行,所以这个方案也是目前最稳妥的办法。

2.在Windows Server 2008上安装Apache或者Nginx,因为Apache或者Nginx和PHP搭配更佳,但是Apache在Windows Server 2008上表现不好,另外这个方案还有个缺点是另外需要配置子域名等,之前没有研究过这方面,所以这个方案备选。

1、PHP下载地址:

http://windows.php.net/downloads/releases/php-5.4.4-nts-Win32-VC9-x86.zip

2、MySQL下载地址:

http://gd.tuwien.ac.at/db/mysql/Downloads/MySQLInstaller/mysql-installer-5.5.25.0.msi

3、PHP加速软件ZendGuard下载地址:

http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-Windows.zip

4、Microsoft .NET Framework 4(独立安装程序)下载地址:

http://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe

5、Microsoft Visual C++ 2010 可再发行组件包 (x64)下载地址:

http://download.microsoft.com/download/3/2/2/3224B87F-CFA0-4E70-BDA3-3DE650EFEBA5/vcredist_x64.exe

6、Microsoft Visual C++ 2008 Redistributable Package (x86)下载地址:

http://download.microsoft.com/download/7/5/0/7502f4e9-1f90-4895-9259-1bde67b8b9a1/vcredist_x86.exe

7、Microsoft Visual C++ 2012 Redistributable Package 下载地址:

https://www.microsoft.com/en-us/download/details.aspx?id=30679

安装篇

最终解决方案:

1.在安装PHP5.6之前,先检查一下是否有Visual C++ 2012运行环境(发行包)。如果没有,先在微软下载中心下载安装。

这里提供下载链接:x86版本x64版本

2.在PHP官网下载PHP5.6,解压缩到任意盘符任意文件夹,当然,如果你想在IIS配置上“偷个懒”的话,可以把原来PHP文件夹改名为PHP5.2,把PHP5.6改为PHP,来替换原来的路径。

接下来是一些较为复杂的步骤,请坐稳了,我们要加速了~

3.在php.ini中修改或确保要有以下配置:

1
cgi.force_redirect = 0

配置的注释上写:

cgi.force_redirect is necessary to provide security running PHP as a CGI under most web servers. Left undefined, PHP turns this on by default. You can turn it off here AT YOUR OWN RISK. You CAN safely turn this off for IIS, in fact, you MUST.

其实,本意是希望提供安全的CGI,但是IIS下,你还是必须把TA关了。

 

1
cgi.fix_pathinfo=1

配置的注释上写:

cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting of zero causes PHP to behave as before. Default is 1. You should fix your scripts to use SCRIPT_FILENAME rather than PATH_TRANSLATED.

这里没有IIS,所以设置为1即可。

 

1
fastcgi.impersonate = 1

配置的注释上写:

FastCGI under IIS (on WINNT based OS) supports the ability to impersonate security tokens of the calling client. This allows IIS to define the security context that the request runs under. mod_fastcgi under Apache does not currently support this feature (03/17/2002)

Set to 1 if running under IIS. Default is zero.

这里很感动此处的注释,把坑都说明清楚了,IIS下,让你设置为1就应该设置为1。

 

1
date.timezone = Asia/Shanghai

时区设置为亚洲上海,但实际上这个配置似乎只作用于你用phpinfo()函数来查看PHP版本,真要用到时区在项目里再写一句声明也可以,已亲测。

4.在IIS中添加程序映射

图片.png

图片.png

图片.png

然后下载个探针  测试就行