DotNetPanel Manuals Center, Guides, "HOW TO" On-Line Library
Installing PHP 5.x with FastCGI on Windows Server 2008 with IIS7 Edit Page Page Info
Last edited Wed, 25 Jun 2008 18:55:44 GMT by Dan Petru, revision 9

To enable FastCGI on IIS 7.0 add CGI role service by going to Server Manager -> Roles -> Add Role Services. This enables both CGI and FastCGI services.

Enable-FastCGI-IIS7.JPG

  1. Download the latest non-thread safe binaries of PHP from http://www.php.net/downloads.php.
  2. Unpack the files to a directory of your choice (e.g. C:\PHP). Rename the php.ini-recommended to php-cgi-fcgi.ini.
  3. Open php-cgi-fcgi.ini file and uncomment and modify settings as follows:

a. Set fastcgi.impersonate = 1;

b. Set cgi.fix_pathinfo=1. cgi.fix_pathinfo;

c. Set cgi.force_redirect = 0;

d. short_open_tag = On;

e. extension_dir = "c:\php5\ext\";

f. uncomment extension=php_mysql.dll;

Open IIS Manager and then select and open “Handler Mappings” at the server level.

IIS7-Handler-Mapping.JPG

Add-PHP-IIS7-Handler-Mapping.JPG

    • Request path: *.php
    • Module: FastCgiModule
    • Executable: C:\[Path to your PHP installation]\php-cgi.exe
    • Name: PHP via FastCGI

Click OK. The dialog box appears asking if you want to create a FastCGI application for this executable. Click Yes.

Add DNP_IUSRS permissions with "Read & execute" on your PHP folder.

PHP Security Recommendations

The following recommendations describe how to tighten security of PHP in shared hosting environment. To make the recommended changes locate and open php-cgi-fcgi.ini file and edit it as described below:

  1. Disable remote URL's for file handling functions:
    • Set allow_url_fopen=Off
    • Set allow_url_include=Off
  2. Disable register_globals:
    • register_globals=Off
  3. Restrict where PHP can read and write on a file system, e.g.:
    • open_basedir="c:\hostingspaces\" or your path to your hosting spaces folder
  4. Disable safe mode:
    • safe_mode=Off
    • safe_mode_gid=Off
  5. Limit script execution time:
    • max_execution_time=30
    • max_input_time=60
  6. Limit memory usage and file sizes:
    • memory_limit=16M
    • upload_max_filesize=2M
    • post_max_size=8M
    • max_input_nesting_levels=64

For more information about PHP and IIS7 please follow http://learn.iis.net/page.aspx/208/fastcgi-with-php/ 

Tags (0)
No tags have been added yet.
Comments (0)
No comments have been added yet.
Attachments (0)
No page attachments found.