About a year ago I wrote an article about how to enable per-site PHP configuration on IIS with FastCGI. The instructions in that article required some non-trivial manipulations of IIS and FastCGI configuration settings. At that time it was one of the primary options for enabling per site php.ini support (other option was to use the htscanner extension for PHP). Now, with PHP 5.3 final release available, it is much simpler to implement the same configuration because PHP 5.3 has built-in support for per-directory INI settings and for user-defined INI files. This post describes how to use these features of PHP 5.3 with IIS to enable per-site and per-directory PHP configuration.
Continue reading “Per-site PHP configuration with PHP 5.3 and IIS”Category: PHP
IIS 7 URL Rewrite Module support in WordPress 2.8
I am pleased to let everyone know that WordPress development community has added a built-in support for IIS 7 URL Rewrite Module in the upcoming WordPress 2.8 release. Starting with version 2.8 the Permalink Settings page will allow you to easily configure “Pretty Permalinks” URL structure when WordPress is running on IIS 7 with URL Rewrite Module v1.1 installed.
Here is how the process of updating Permalinks structure will look like in WordPress 2.8 on IIS 7:
Continue reading “IIS 7 URL Rewrite Module support in WordPress 2.8”Install PHP with Microsoft Web Platform Installer 2.0
While the task of setting up PHP on IIS was not a difficult one, it anyway required a lot of manual installation and configuration steps. With the PHP 5.2.9-1 release the PHP development community has put a lot of improvements to the PHP installer to make it easy to setup PHP on IIS 5.1, IIS 6.0 and IIS 7.0. The latest PHP installer can be downloaded from the PHP community site.
Now, with the release of Microsoft Web Platform Installer 2.0 Beta (Web PI), the task of enabling PHP on Windows OS has become the easiest it has ever been. Here are the three simple steps you need to follow:
Continue reading “Install PHP with Microsoft Web Platform Installer 2.0”Windows Installer for PHP 5.2.9 RC and PHP 5.3 Beta
I am pleased to let everyone know that PHP development community has made significant improvements to the installer in upcoming PHP releases. In particular a number of bugs have been fixed to make the installer work well with FastCGI extension in IIS 5.1 and IIS 6.0 and with FastCGI module in IIS 7.0. Now the installer will do for you many of the configuration steps that previously you had to complete manually by following the instructions in the article Using FastCGI to Host PHP Applications on IIS 7.0. Specifically, the installer will:
- Unpack PHP core files and extensions
- Make changes to the php.ini to enable necessary extensions and specify correct extension path
- Create and configure a new FastCGI process pool for PHP executable
- Create a script or handler mapping for *.php extension.
Download the PHP installer for non-thread-safe build of PHP from this location:
Continue reading “Windows Installer for PHP 5.2.9 RC and PHP 5.3 Beta”Major revision of FastCGI/PHP article on IIS.NET
Since the time we have published the article about installing FastCGI and PHP on IIS 7.0 it has become one of the most popular articles on http://learn.iis.net. Also it has received a lot of comments from site visitors. Today, we are publishing the updated version of this article that contains more up-to-date information and addresses most of the feedback from community. Here is what this article includes now:
- Overview
- Enabling FastCGI support in IIS 7.0
- Install and Configure PHP
- Configure IIS to handle PHP requests
- Best practices for configuring FastCGI and PHP
- Per-site PHP configuration
- URL rewriting for PHP applications
- Related Resources
Please take a look at the new content and leave comments if you have any questions of feedback.
Acknowledgments: I would like to thank IIS.NET visitors who have provided their comments and corrections to this article. Also I thank Jake and Bill for doing a final review of the article.
Update for IIS 7.0 FastCGI module
IIS team has recently released an update for IIS 7.0 FastCGI module that fixes compatibility problems with several popular PHP applications. In particular, the update changes the behavior of FastCGI module in the following ways:
- REQUEST_URI server variable set by FastCGI module now includes query string and path info. Previously, lack of the query string in this server variable caused the popular CMS application Drupal to not work with FastCGI on IIS 7.0
- REQUEST_URI server variable now contains the originally requested URL path before any URL rewriting was performed. Prior to this fix, the server variable used to contain a final rewritten URL, which caused problems when using URL rewriting to enable “pretty permalinks” for popular blog engine WordPress.
Note that above mentioned problems do not exist in IIS 6.0 FastCGI Extension, which always has been setting the REQUEST_URI server variable correctly.
The update is available for download from the following locations:
- Update for Windows Server 2008
- Update for Windows Server 2008 x64 Edition
- Update for Windows Server 2008 for Itanium-based Systems
- Update for Windows Vista SP1
- Update for Windows Vista SP1 for x64 based Systems
Warning: if your PHP application was coded in a way so that it relied on the REQUEST_URI server variable to contain the requested URL without a query string or to contain the final rewritten URL, then installing this update may break your application. Before applying the update, please make sure that your application does not rely on incorrect behavior of FastCGI module.
Acknowledgements: I want to thank IIS team members (Anil Ruia, Won Yoo, Yamini Jagadeesan) for providing this update and Zend Technologies team (Stanislav Malyshev) for validating the changes in FastCGI module.
Per-site PHP configuration with IIS FastCGI
There have been a few questions on IIS.NET PHP forum regarding enabling per-site PHP configuration. This is a common requirement when running PHP applications in shared hosting environment, because each PHP application may require a different set of PHP settings. Shared hosting providers often want to provide their customers with an option of controlling PHP configuration if necessary.
Until recently, it was thought that per-site PHP configuration was only possible when running PHP on Apache in *nix based OS. However, with FastCGI module it is possible to enable this for PHP applications hosted on IIS 6.0 and IIS 7.0.
The development team at GoDaddy.com has researched and validated several options for enabling per-site PHP configuration on Windows. Based on their findings, we have updated the PHP shared hosting guide with instructions on how to allow per-site php.ini files when running PHP via FastCGI on IIS 7.0. In this post I will explain how to accomplish the same on IIS 6.0 by using FastCGI extension.
Assume we have two web sites in IIS 6.0 – website1.com and website2.com. We want each web site to use its own version of php.ini file. Let’s assume that php.ini for website1.com is located in C:\Inetpub\website1.com folder and php.ini for website2.com is located in C:\Inetpub\website2.com folder.
Continue reading “Per-site PHP configuration with IIS FastCGI”