How to Parse .html Files as PHP in IIS 6 with Zend Server

Follow

Applies To:

[ Zend Server 4.x ]
[ Windows ]

Overview

By default only the .php extension will be parsed as PHP code by the web server. This article explains how to configure Microsoft IIS 6 for parsing other extensions as PHP. We take .html as the example for this article, other extensions can be added in a similar way. The process consists of two stages - configuring IIS to use FastCGI for .html files and configuring FastCGI to call PHP for parsing .html files.

Instructions

Configuring IIS to Use FastCGI for .html Files

  1. Open the IIS Management Console (C:\Windows\system32\inetsrv\iis.msc).
  2. Locate your Web Site, right-click it and choose Properties.
  3. Switch to the Home Directory tab and click Configuration. This will open the Application Configuration dialog.
  4. On the Mappings tab, click Add.
  5. Click Browse and locate your IIS FastCGI module. For Zend Server this will be:
    C:\Windows\system32\inetsrv\fcgiext.dll
    (you can copy the location from the .php mapping, in the Application Configuration dialog)
  6. In the Extension field, type ".html".
  7. Make sure that both Script Engine and Verify that file exists checkboxes are marked.
  8. Click OK in all open dialogs (3 times) to confirm the changes and close them.

Configuring FastCGI to Call PHP for Parsing .html Files

  1. Locate the fcgiext.ini configuration file in the IIS directory (C:\Windows\system32\inetsrv\fcgiext.ini) and open it in your favorite text editor.
  2. Add the .html extension to the Types section and set it to use PHP as CGI application:
[Types]
php=PHP
html=PHP 

[PHP]
ExePath=C:\Program Files\Zend\ZendServer\bin\php-cgi.exe
EnvironmentVars=PHPRC:C:\Program Files\Zend\ZendServer\etc,PHP_FCGI_MAX_REQUESTS:10000

  1. Save and close the file.

Result

Create the test.html file containing simple PHP code (for example: <?php phpinfo(); ?>). Open this file in your web browser (for example: http://localhost/test.html). The output should be result of processing the test.html file by the PHP engine.


Excerpt: By default only the .php extension will be parsed as PHP code by the web server. This article explains how to configure Microsoft IIS 6 for parsing other extensions as PHP.


Original Post Date: 2009-10-23 14:09:18

Alternative Description:

By default only the .php extension will be parsed as PHP code by the web server. This article explains how to configure Microsoft IIS 6 for parsing other extensions as PHP.

_____
Tags: FastCGI,fcgiext.dll,fcgiext.ini,html,iis,MS Windows 2003 Server,MS Windows 2008 Server,MS Windows 7,MS Windows XP,php,Zend Server 4.x,oldKB

Have more questions? Submit a request

Comments

Powered by Zendesk