配置windows server 2008的iis7.0支持fastcgi运行php
事情是这样的。我的电脑在C盘装的是XP,E和F盘装的是WINDOWS SERVER 2008。用来做服务器的是F盘的WINDOWS SERVER 2008。在XP系统下,我直接安装了Appserv套件,包括PHP,MYSQL,PHPMYADMIN,安装路径为D盘。而现在准备在F盘的WINDOWS SERVER 2008系统下配置IIS7.0以支持fastcgi运行PHP。
当然,像前文所述,在服务管器中添加支持fastcgi的功能。
然后,去php.net/download">http://www.php.net/download下载一份最新版的non-thread safe zip package。解压到我的D盘的Program Files下的PHP目录。
现在就是配置IIS 7.0了。打开IIS管理控制台,新建一个站点,名称为PHPHOME。当然,由于我将其端口绑定为80,故应先修改已有的那个站点Default Web Site所绑定的端口(改成8080吧)。 路径为我放在D盘www路径下的PHP程序。注意:应用程序池选DefaultAppPool。如下图,请看仔细各个配置:
然后单击PHPHOME,双击右边的处理程序映射(Handler Mappings),点击右边出现的操作中的“添加模块映射(Add Module Mapping...)”,如下配置各个项目:
点击确定。如果提示不成功,可以把“可执行文件”下面的路径加上双引号括起来,再点确认。
- Request path: *.php
- Module: FastCgiModule
- Executable: "C:[Path to your PHP installation]php-cgi.exe"
- Name: PHP via FastCGI
点击默认文档,添加index.php
还得注意的是:
1.安装MYSQL。由于我XP已在D盘安装过MYSQL,故这里直接共用那个程序。运行,CMD,打开命令行,输入:d:Progra~1AppservMysqlBINMYSQLD-NT.EXE --INSTALL,回馈的结果是已经安装MYSQL服务。注:这个命令其实就是运行安装MYSQLD-NT.EXE。
2.配置PHP及PHPMYADMIN。
-
- Rename the php.ini-recommended to php.ini.Open the php.ini file, then uncomment and modify settings as follows:
- Set fastcgi.impersonate = 1. FastCGI under IIS supports the ability to impersonate security tokens of the calling client. This allows IIS to define the security context that the request runs under.
- Set cgi.fix_pathinfo=1. cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHPs previous behavior was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not care 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
- Set cgi.force_redirect = 0.
- Set open_basedir to point to a folder or network path where the content of the web site(s) is located.
相关新闻>>
- 发表评论
-
- 最新评论 更多>>