Board logo

标题: [转帖]WINDOWS2003下配置PHP5 [打印本页]

作者: skyxhc    时间: 2005-4-10 18:44     标题: [转帖]WINDOWS2003下配置PHP5

http://www.peterguy.com/php/install_IIS6.txt

安装主要包括以下三部:
1. 安装 PHP
2. 配置 PHP (主要编辑 php.ini 文件)
3. 配置 IIS (在 IIS Manager)
*************************
1. 安装PHP
*************************

- 解压最新版本的 PHP 到 d:\PHP (这里用 5.0.2)
- 将 d:\php\php.ini-recommended 改名为 php.ini
*************************
2. 配置 php.ini
*************************
- 恢复  php.ini文件中"cgi.force_redirect" 变量,设为 0
*** 这一步非常重要不要错过. ***

- 下载browscap.ini文件 (http://www.garykeith.com/browsers/stream.asp?PHP_BrowsCapINI) 到 d:\PHP\extras\browscap.ini
- 恢复 php.ini 文件中browscap 变量 ,值设为d:\PHP\extras\browscap.ini
- 授予 IUSR 用户对文件 php.ini 读和执行,  读权限
- 创建用于保存会话的文件夹,授权 IUSR 对文件夹全权
  同时将php.ini中的"session.save_path" 指到该文件夹.
- 恢复 php.ini 文件中 "extension_dir" 到"d:\PHP\ext"
- 恢复 php.ini 文件中 "extension=" 部分内容
- 将所有非php dll 文件从d:\PHP 拷贝到 C:\Windows\System32
  或者在环境变量path中加入 "d:\PHP",此设置需要重新启动机器后生效.
- 如果使用 MySQL 4.1.5 或更高版本,在 "extension=php_mysql.dll"后加入下面内容,"extension=php_mysqli.dll"

-将下面注册表文件导入:
inifilepath.reg.
---------------------------------------------------------
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\PHP]
"IniFilePath"="C:\\PHP"
---------------------------------------------------------
*************************
3. 配置 IIS
打开 IIS 管理器 (开始->控制面板->管理工具->Internet
Information Services (IIS) Manager).
*************************
-When you open IIS Manager, it should connect to the local computer automatically.  Expand the local computer in the left pane, then click on "Web Service Extensions" in the left pane.
In the right pane, now, click the blue underlined text, "Add a new Web service extension...". Enter "PHP ISAPI Extension" as the "Extension name", then click the "Add..." button and browse to the php5isapi.dll file in your PHP install directory.
There are 2中方式setup PHP for the web: ISAPI and CGI.
1, ISAPI is typically more efficientand secure.
2,  If you want to add the CGI extension, in addition to or instead of the ISAPI, repeat the above, but enter "PHP CGI Extension" as the "Extension name", and browse to php-cgi.exe in your PHP install directory for the "Required files".

Once you';ve named it appropriately and chosen the desired file, check the "Set extension status to Allowed" checkbox and click "OK".

The following two steps are suggested to apply to the "Web Sites" root folder in IIS Manager, but they can be applied to individual sites, instead.  When applying changes to "Web Sites", note that a dialog might come up asking if you want to apply changes to a list of specific websites,too.
Note that the listed sites will be ones that have overridden any default values, so be careful about applying changes to them.  Especially be careful of applying changes to the Microsoft SharePoint Administration site (thus speaks painful experience).
- Right-click on "Web Sites", goto Properties->Home Directory->Configuration...->Application
Extensions, add a new extension: .php using C:\PHP\php5isapi.dll; allow GET,POST,HEAD.  This will
apply to every website.
This sets up IIS to actually respond to requests for php files.  "Web Sites" is a "folder" in the left pane of IIS Manager.  php5isapi.dll will be in your PHP install directory.  Replace php5isapi.dll with php-cgi.exe if you chose the CGI extension.

- Turn on scripting permissions for your websites
Right-click on "Web Sites", goto Properties->Home Directory.
Change the "Execute permissions" dropdown to "Scripts only".
- 重新启动IIS
Right-click the local computer in the left pane of IIS Manager, click on All Tasks->Restart IIS...->OK
*** 或 ***
- Reboot server
Only if you modified the server';s PATH environment variable for the extensions and haven';t rebooted yet.

- Create a new file named test.php in one of the websites containing the single line below:
Expand the "Web Sites" folder in the left pane of IIS Manager to see a list of existing websites.
Right-click->Properties->Home Directory->Local Path will show you where the website root directory is.
- Point browser there to test.
*** NOTE ***
If you uncommented extensions, be sure to test this from the server';s console, not another computer, or even Terminal Services.  Some of the extensions don';t work, and an error dialog will pop up on the server console telling which one didn';t work.  You have to be able to click "OK" to the dialog for the page to finish loading.  Take note of the extension that didn';t work, click
"OK", and then comment out the extension in php.ini until you can figure out how to get it to work.





欢迎光临 黑色海岸线论坛 (http://bbs.thysea.com/) Powered by Discuz! 7.2