开发者

how to setup IIS so that it can process PHP code in HTML pages

is there a way to setup windows server 2003 IIS so that PHP code can be included in开发者_运维问答 HTML and HTM documents?


set up PHP on IIS as normal and then map .htm/html isapi extension to use PHP executable. To do this, first right-click on "Web Sites" in the left-hand menu and select "Properties". Here you can change your ISAPI extensions. Find the htm and html extensions and change executable to the same as .php-extension.


Steps to Install PHP on IIS

  1. Open your browser to PHP for IIS Windows Download Page and download the PHP non-thread-safe zip package.
  2. Download the WinCache extension from the List of Windows Extensions for PHP.
  3. Extract all files in the PHP .zip package to a folder of your choice, for example C:\PHP.
  4. Extract the WinCache .zip package to the PHP extensions folder (\ext), for example C:\PHP\ext. The WinCache .zip package contains one file (Php_wincache.dll).
  5. Open Control Panel, click System and Security, click System, and then click Advanced system settings.
  6. In the System Properties window, select the Advanced tab, and then click Environment Variables.
  7. Under System variables, select Path, and then click Edit.
  8. Add the path to your PHP installation folder to the end of the Variable value, for example; C:\PHP. Click OK.
  9. Open IIS Manager, select the hostname of your computer in the Connections panel, and then double-click Handler Mappings.
  10. In the Action panel, click Add Module Mapping.
  11. In Request path, type *.php.
  12. From the Module menu, select FastCgiModule.If you don't find CGI Module follow the below steps. How to Enable FastCgiModule? Step 1: Go to Control Panel\Programs\Programs and Features and click on Turn windows features on or off Step 2: Go to Internet Information services\World Wide Web Services\Application Development Features check/enable the CGI and press okay to apply the changes. Step 3:After enabling FASTCGI module IIS server should be restarted.

    how to setup IIS so that it can process PHP code in HTML pages

  13. In the Executable box, type the full path to Php-cgi.exe, for exampleC:\PHP\Php-cgi.exe.
  14. In Name, type a name for the module mapping, for example FastCGI.
  15. Click OK.
  16. Select the hostname of your computer in the Connections panel, and double-click Default Document.
  17. In the Action panel, click Add. Type Index.php in the Name box, and then click OK.
  18. Click Add again. Type Default.php in the Name box, and then click OK.

    how to setup IIS so that it can process PHP code in HTML pages

    how to setup IIS so that it can process PHP code in HTML pages

  19. After adding IIS server should be restarted.

To test your PHP installation 1. Open a text editor, for example Notepad, as Administrator. 2. In a new file, type the following text: 3. Save the file asC:\inetpub\wwwroot\Phpinfo.php. 4. Open a browser and enter the following URL: http://localhost/phpinfo.php


Yes. You have to add isapi.dll plugin from php distrib. You do that in properties window for your website


The best way to install PHP for IIS is via Web PI. It is guaranteed that you will get the latest PHP installer supported by IIS and that it does the right configuration.

Then, to configure your PHP installation with IIS7+ in the simplest way, you can use PHP Manager. Here is a walkthrough on how to use it (also very intuitive). Finally, PHP Manager can easily help you manage and switch between different PHP installations, detect errors or inconsistency in PHP configuration.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜