在windows server 2003 IIS6下安装PHP 5.3x

原文链接:http://www.webjss.com/server-2003-iis6-php5-3.html

配置需要的文件

php-5.3.8-nts-Win32-VC9-x86.zip

下载地址:http://windows.php.net/downloads/releases/php-5.3.8-nts-Win32-VC9-x86.zip

fcgisetup_1.5_rtw_x86.msi

下载地址:http://www.iis.net/download/fastcgi

vcredist_x86.exe

下载地址:u.115.com/file/f09e2fe4d2

首先安装

vcredist_x86.exe这个文件是VC的运行环境的 如果有VC可以不装

然后安装

fcgisetup_1.5_rtw_x86.msi

然后解压php-5.3.8-nts-Win32-VC9-x86.zip到C:\PHP5下

然后复制根文件夹下所有DLL到C:\WINDOWS\SYSTEM32\下

然后目把php.ini-development复制一份,然后重命名为php.ini

打开php.ini后

修改以下参数

extension_dir = "C:\PHP5\EXT\"

;fastcgi.impersonate = 1 去掉;

;short_open_tag = Off 去掉; OFF修改为ON

;date.timezone = 去掉; 赋值为PRC

; extension=php_curl.dll 去掉;

; extension=php_gd2.dll 去掉;

; extension=php_ldap.dll 去掉;

; extension=php_mbstring.dll 去掉;

; extension=php_exif.dll 去掉;

; extension=php_mysql.dll去掉;

; extension=php_mysqli.dll 去掉;

; extension=php_sockets.dll 去掉;

; extension=php_xmlrpc.dll 去掉;

修改完后将文件剪切到C:\windows下

注册PHP 到 FastCGI

fcgisetup_1.5_rtw_x86.msi后会在

C:\WINDOWS\system32\inetsrv\生成一个fcgiext.ini文件

在文件末尾添加

[Types]

php=PHP

[PHP]

ExePath=C:\Program Files\PHP\php-cgi.exe

InstanceMaxRequests=10000

ActivityTimeout=300

RequestTimeout=600

EnvironmentVars=PHP_FCGI_MAX_REQUESTS:10000,PHPRC:C:\ProgramFiles\PHP\

然后在IIS网站里添加应用程序扩展

网站-》属性-》主目录-》配置-》映射-》添加可执行文件路径是: C:\WINDOWS\system32\inetsrv\fcgiext.dll,扩展为.PHP

PS:配置FastCGI中的一些错误和解决方法

在配置FastCGI的时候中间我也遇见很多错误,下面是我的记录:

我第一次安装时,运行的安装代码

cscript fcgiconfig.js -add -section:"PHP" -extension:php -path:"C:\Program Files\PHP\php-cgi.exe"

则显示了

C:\WINDOWS\system32\inetsrv\fcgiconfig.js(1326, 5) (null): Section already exists, section=PHP

可能是由于为了服务器的安全我的安装系统删除了wsshell命令,导致在执行时出现了错误

Microsoft JScript 运行时错误: Automation 服务器不能创建对象 解决办法:重新注册命令:regsvr32 WSHom.ocx 更多关于IIS组件安装与卸载

————————————————————————————————————————————————

一运行测试页面就显示500错误

j解决方法:

打开IE----INTERNET选项--------高级------------显示友好的HTTP错误前面的勾去掉,再出现错误的时候会提示你错误的具体提示。

提示:

PHP Warning: Unknown: open(c:\php\upload_tmp\sess_li3ardp5qtalfj4, O_RDWR) failed: Permission denied (13) in Unknown on line 0 PHP Warning:

Unknown: open(c:\php\upload_tmp\sess_li3ardbp5qtalfj4, O_RDWR) failed: Permission denied (13) in Unknown on line 0 PHP Warning: Unknown: Failed

to write session data (files). Please verify that the current setting of session.save_path is correct (c:\php\upload_tmp) in Unknown on line 0 这说明我没有给c:\php\upload_tmp写入权限,给了.写入权限,解决!

———————————————————————————————————————————————————

收集的问题:

Q1: 重启IIS后,打开测试页出现如下提示:

FastCGI Error The FastCGI Handler was unable to process the request. --------------------------------------------------------------------------------

Error Details:

Error Number: 5 (0x80070005). Error Description: 拒绝访问。 HTTP Error 500 - Server Error. Internet Information Services (IIS)

这个错误是由于在解压PHP之后,没有对IIS启动帐户赋予该目录的读取和运行权限.修改文件夹安全属性,问题解决.

Q2: 在写php程序中有时会出现这样的警告:PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for '8.0/no DST' instead in D:/PHPWEB/news/file.php on line 17 。这是因为PHP所取的时间是格林威治标准时间,所以和你当地的时间会有出入格林威治标准时间和北京时间大概差8个小时左右,我们可以按照下面的方法解决:

1、在页头使用date_default_timezone_set()设置我的默认时区为北京时间,即

< ?php

date_default_timezone_set("PRC");

?>就可以了。

2、在php.ini中设置date.timezone的值为PRC,设置好以后的为:date.timezone=PRC,同时取消这一行代码的注释,即去掉前面的分号就可以了。

Q3: 还遇到一个问题,就是运行时,页面显示空白,或者无法显示(404),请检查主目录中的php文件名映射,删除,重新添加一个默认的即可

还有一种问题,如下:

FastCGI Error The FastCGI Handler was unable to process the request. -------------------------------------------------------------------------------- Error Details: Could not find entry for "php" on site 2043809562 in [Types]section. Error Number: 1413 (0x80070585). Error Description: 无效索引。 HTTP Error 500 - Server Error. Internet Information Services (IIS) 这个错误我就没处理过了,后来找到了这个页面:http://forums.iis.net/t/1146956.aspx,知道原来FastCGI也有配置文件的,文件名: C:\WINDOWS\system32\inetsrv\fcgiext.ini 我的服务器出现这个错误,是因为微软Web平台配置程序没有正确配置这个文件,正确的配置应该如下: [Types] php=PHP [PHP] ExePath=C:\Program Files\PHP\php-cgi.exe InstanceMaxRequests=10000 ActivityTimeout=300 RequestTimeout=600 EnvironmentVars=PHP_FCGI_MAX_REQUESTS:10000,PHPRC:C:\ProgramFiles\PHP\ 这样配置之后,PHP程序就可以正常运作啦! 顺便说一句,微软Web平台安装FastCGI时,会自动选择合适的PHP版本(32位或64位),不需要人工去区别了

-我按以上问题处理流程处理,问题依旧,因此我将 ExePath=C:\Program Files\PHP\php-cgi.exe 这句(我的是d:/php53/php-cgi.exe) 将 ” / “ 改成 ” \ “ 即可

错误1, FastCGI Error The FastCGI Handler was unable to process the request. Error Details: The FastCGI process exited unexpectedly Error Number: -2147467259 (0x80004005). Error Description: 未指定的错误 HTTP Error 500 - Server Error. Internet Information Services (IIS)

    搜索: register_globals = Off (约第705行) 将Off更改为 On,该行的注释符,即前面的分号”;”去掉,使该行在php.ini文档中起作用,即得到 register_globals = On ; 注:这个对于PHP的全局变量功能,考虑有很多PHP程序需要全局变量功能所以打开,打开后请注意PHP程序的严谨性,如果不需要全局变量功能,或者出错,请保持默认Off状态。    

错误2, fastcgi error the fastcgi handler was unable to process the request. -------------------------------------------------------------------------------- error details: error number: 5 (0x80070005). error description: 拒绝访问。 http error 500 - server error. internet information services (iis) 这个错误是由于在解压php之后,没有对iis启动帐户赋予该目录的读取和运行权限.修改文件夹安全属性,问题解决.

错误3, FastCGI Error The FastCGI Handler was unable to process the request. -------------------------------------------------------------------------------- Error Details: Could not find entry for "php" on site 1960240566 in [Types] section. Error Number: 1413 (0x80070585). Error Description: 未指定的错误 HTTP Error 500 - Server Error. Internet Information Services (IIS)

即说明没有安装成功!请按照fcgiext.ini 修改配置即可!!

错误4, ---------- FastCGI Error

The FastCGI Handler was unable to process the request.

Error Details:

The FastCGI process exited unexpectedly Error Number: -1073741819 (0xc0000005). Error Description: Unknown Error HTTP Error 500 - Server Error. Internet Information Services (IIS) -------- 我的PHP目录在C盘 当时配置PHP.INI的时候就在那个安装目录编辑好,再复制到windows目录下的... 结果恰恰是C:\PHP\php.ini 这个"备份"文件的存在 干扰了FastCGI的运行,总是提示我。 把 C:\php\php.ini 删除,搞定! 随后用FakeCGI调试工具才搞定原因.. 感谢FakeCGI,痛斥我的坏习惯!!!

FastCGI Error编号14001错误,处理办法

FastCGI Error编号14001错误解决办法

下载并安装Microsoft Visual C++ 2008 Redistributable Package (x86)

Microsoft Visual C++ 2008 Redistributable Package (x86) 安装 Visual C++ 库的运行时组件,使用户能够在未安装 Visual C++ 2008 的计算机上运行使用 Visual C++开发的应用程序。

本程序包为C 运行时库 (CRT)、标准 C++、ATL、MFC、OpenMP 和 MSDIA 库安装运行时组件。对于支持并行部署模型的库(CRT、SCL、ATL、MFC、OpenMP),这些运行时组件被安装到支持并行程序集的 Windows 操作系统的本机程序集缓存(也称为WinSxS 文件夹)中。有关受支持的 Visual C++ 应用程序部署方式,请单击此处

此错误是在IIS6的FastCGI模式下配置PHP5.3.6时出现的。

然后就可以建立站点测试PHP环境是否配置成功