> php教程 > php手册 > Win7下通过FastCGI配置IIS7以执行php脚本

Win7下通过FastCGI配置IIS7以执行php脚本

WBOY
풀어 주다: 2016-06-06 19:59:23
원래의
1134명이 탐색했습니다.

Name: PHP via FastCGI 3. Modify the Resuest Restrictions configuration: 4. Click OK . and 4. In the Add Module Mapping confirmation dialog box that asks if you want to create a FastCGI application for this executable, click Yes .\ 5. Test t

Name: PHP via FastCGI

 

Win7下通过FastCGI配置IIS7以执行php脚本

 

3. Modify the Resuest Restrictions configuration:

    Win7下通过FastCGI配置IIS7以执行php脚本

 

4. Click OK. and 4. In the Add Module Mapping confirmation dialog box that asks if you want to create a FastCGI application for this executable, clickYes.\

Win7下通过FastCGI配置IIS7以执行php脚本

 

5. Test that the handler mapping works correctly by creating a phpinfo.php file in the C:\inetpub\wwwroot folder that contains the following code:

6. Open a browser and navigate to http://localhost/phpinfo.php. If everything was setup correctly, you will see the standard PHP information page.

在这一步中,为了更加方便地检测Php是否安装成功,可以在cmd中,cd到c:\php目录下执行:php-cgi.exe D:\phpTest\test.php来验证。

Win7下通过FastCGI配置IIS7以执行php脚本

NOTE: If you do not see FastCgiModule in theModules: list, the module is either not registered or not enabled. To check if the FastCGI module is registered, open the IIS configuration file that is located at %windir%\windows\system32\config\applicationHost.config and check that the following line is present in the div:

In the same file, also check that the FastCGI module is added to the div:

Configure IIS 7 to handle PHP requests by using the command line

Alternatively, you can complete the steps above by using the command line tool AppCmd.

1. Create the FastCGI application process pool by running the following command:

C:\>%windir%\system32\inetsrv\appcmd set config /div:system.webServer/fastCGI /+[fullPath='c:\{php_folder}\php-cgi.exe']

2. Create the handler mapping by running the following command:

C:\>%windir%\system32\inetsrv\appcmd set config /div:system.webServer/handlers /+[name='PHP_via_FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='c:\{php_folder}\php-cgi.exe',resourceType='Unspecified']

 

Note: If you are using PHP version 4.X, you can use php.exe instead of php-cgi.exe.

BTW,  在这个过程中,可能会遇到500错误:

Error info:

HTTP Error 500.0 - Internal Server Error
C:\PHP\php-cgi.exe - The FastCGI process exited unexpectedly

Detailed Error Information

Module: FastCgiModule
Notification: ExecuteRequestHandler
Handler: PHP via FastCGI
Error Code: 0x000000ff
Requested URL: localhost/test.php
Physical Path: C:\inetpub\wwwroot\test.php
Logon Method: Negotiate
Logon User: Domain\user

引起这个问题的关键还是php.ini文件的设置有问题,可以通过排除法来解决:直接到 c:\php目录下,双击PHP-CGI.EXE, 在弹出的命令行窗口下看具体是什么错误,然后相应地修改php.ini文件,清除掉(用;注释掉)无效的或者提示找不到的extensions,就可以使用了。

Try to execute PHP-CGI.EXE (BY DOUBLECLICKING ON IT). See if you get any error messages/ pop-ups. I got a ton of them and it all boiled down on having a bunch of extensions turned on, but not being available in my ext folder. Clear the PHP.INI of those invalid extensions and the problem should go away.

원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 추천
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿