-将下面注册表文件导入:
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.