<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>RuslanY Blog &#187; FastCGI</title>
	<atom:link href="http://ruslany.net/tag/fastcgi/feed/" rel="self" type="application/rss+xml" />
	<link>http://ruslany.net</link>
	<description>IIS, FastCGI, PHP and other interesting stuff</description>
	<lastBuildDate>Fri, 30 Jul 2010 23:07:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Slides and Questions from PHP on Windows Webcast</title>
		<link>http://ruslany.net/2010/04/slides-and-questions-from-php-on-windows-webcast/</link>
		<comments>http://ruslany.net/2010/04/slides-and-questions-from-php-on-windows-webcast/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 19:11:56 +0000</pubDate>
		<dc:creator>ruslany</dc:creator>
				<category><![CDATA[FastCGI]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WinCache]]></category>

		<guid isPermaLink="false">http://ruslany.net/?p=737</guid>
		<description><![CDATA[On April 9, Mark Brown and I did a PHP&#124;Architect webcast “PHP Performance On Windows”. The slides from the presentation have been published at the following link: PHP Performance on Windows – slides There were a number of question at the end of the webcast that we did not get to answer due to lack [...]]]></description>
			<content:encoded><![CDATA[<p>On April 9, <a href="http://blogs.msdn.com/markbrown/">Mark Brown</a> and I did a PHP|Architect webcast “PHP Performance On Windows”. The slides from the presentation have been published at the following link:</p>
<p><a href="http://www.slideshare.net/ruslany/php-performance-on-windows">PHP Performance on Windows – slides</a></p>
<p>There were a number of question at the end of the webcast that we did not get to answer due to lack of time. This blog post provides answers to those questions.<span id="more-737"></span></p>
<p><strong>Q: Why is php_mssql.dll removed from php 5.3.2?<br />
</strong>A: The reason why it was removed was because of an incompatible driver. The last SDK supported by Microsoft was not compatible anymore with VC6. Anyway, php_mssql.dll is not recommended to be used with SQL Server because there is a SQL Driver for PHP that is officially supported by Microsoft. You can get more information about the driver at <a href="http://blogs.iis.net/donraman/archive/2010/01/25/working-with-microsoft-sql-server-driver-php-sqlsrv-dll-for-php-on-windows.aspx">Working with Microsoft SQL Server driver (php_sqlsrv.dll) for PHP on Windows</a>.</p>
<p><strong>Q: How can we have .htaccess file features work on IIS? Is there an alternative?<br />
</strong>A: There are several options. If you just want Apache mod_rewrite rules to work on IIS, then you can <a href="http://learn.iis.net/page.aspx/470/import-apache-modrewrite-rules/">import them from a .htaccess file</a>. If you want complete support for all .htaccess features then you can try <a href="http://www.helicontech.com/ape/">Helicon Ape</a> from HeliconTech. Regarding PHP specific features in .htaccess file &#8211; for PHP 5.2 you could use htscanner PECL extension. In PHP 5.3 there is a new feature for <a href="http://ruslany.net/2009/07/per-site-php-configuration-with-php-5-3-and-iis/">per directory PHP configuration and .user.ini files</a>.</p>
<p><strong>Q: Do you have any numbers to compare iis performance with other web servers(apache, nginx, lighttpd)?<br />
</strong>A: No, we do not have any numbers that can be shared. It’s difficult to come up with an objective test that compares web server technologies – there are too many variables and interpretations of the results and even if Microsoft ever produced such numbers they would probably cause a lot of controversy over the objectivity of those tests.</p>
<p><strong>Q: Do you plan to implement wincache library for Zend Framework(Zend_Cache)?<br />
</strong>A: WinCache team does not have plans for that, but there is already a PHP developer who is working on implementing this: <a href="http://github.com/juokaz/wincache">http://github.com/juokaz/wincache</a>.</p>
<p><strong>Q: We have discussed here sugar CRM. Is Microsoft planning to do enhancement in sugar CRM functionality?</strong><br />
A: Microsoft works well with Sugar CRM development team and Sugar CRM add enhancements to their future versions to support new features from Microsoft, such as WinCache user and session cache for example. Microsoft, however does not contribute any code and does not work directly on any enhancements to Sugar CRM.</p>
<p><strong>Q: Is Microsoft planning to develop any dll which can make PHP code to Intermediate language?</strong><br />
A: Assuming that the question is about .NET intermediate language &#8211; no, there are no plans for this.</p>
<p><strong>Q: Would there be any tool in Microsoft development tool kit for PHP?<br />
</strong>A: There are several projects in Microsoft that provide development tools and instructions for enabling interoperability between PHP and other Microsoft technologies. You can find more details about those projects here: <a href="http://www.interoperabilitybridges.com/">http://www.interoperabilitybridges.com/</a>.</p>
<p><strong>Q: Is WinCache shared data accessible for CLI? Script A launches Script B, C and D &#8230; ?<br />
</strong>A: Yes, you can access the shared data from CLI as long as you set wincache.enablecli = 1 in php.ini and all the CLI processes have the same parent process.</p>
<p><strong>Q: Are the statistics results of WinCache the same in 5.2.13 as in 5.3?<br />
</strong>A: If the question is about wincache.php statistics script then yes – the data presented by that script is the same regardless of the PHP version.</p>
<p><strong>Q: Are there any security concerns with having wincache store session data in shared memory?</strong><br />
A: If you use different IIS application pools for different web sites (which is the recommended configuration), then WinCache ensures that those web sites can not access each other’s cache data. All caches, not just the session cache are not shared across IIS application pools.</p>
<p><strong>Q: Is it safe to write to the user cache assuming data disappears from the system after the cache times out? Is the content of the user cache in wincache 1.1 written to disk at all?<br />
</strong>A: Normally the data in the user cache is deleted from the cache after the time to live interval, but the deletion happens on the main request processing thread. This means that if there are no requests to process, the entries in the cache may stay longer than the TTL. WinCache does not write user cache content to disk, but if memory pagefile is enabled on the server, then it may happen that the memory content will be stored by OS in a pagefile. If a maching (not just a process) crashes when user cache content is in the pagefile, then the content may be present on disk.</p>
<p><strong>Q: Is the sqlsrv driver going to be compatible with PDO?<br />
</strong>A: <a href="http://blogs.msdn.com/interoperability/archive/2010/04/19/sql-server-driver-for-php-2-0-ctp-adds-php-s-pdo-style-data-access-for-sql-server.aspx">SQL Driver for PHP 2.0</a> will include PDO support.</p>
<p><strong>Q: Is there any documentation on securely configuring php/FastCGI in a shared application pool environment on IIS6 so that websites?<br />
</strong>A: Check the article about <a href="http://www.php.net/manual/en/install.windows.iis6.php">setting up PHP on IIS6</a> and look for the section called “Impersonation and file system access”. If this is not what you are looking for – let me know.</p>
<p><strong>Q: When are we going to see PHP 5.3 in the WPI?<br />
</strong>A: Web PI team is planning to add support for PHP 5.3 in near future. Most probably it will be possible to select which version of PHP to install from Web PI. This is because there are some PHP applications in Web PI that will never support PHP 5.3.</p>
<p>Thanks to all who has attended the webcast and asked interesting questions!</p>
]]></content:encoded>
			<wfw:commentRss>http://ruslany.net/2010/04/slides-and-questions-from-php-on-windows-webcast/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP on IIS: MonitorChangesTo setting in FastCGI</title>
		<link>http://ruslany.net/2010/03/php-on-iis-monitorchangesto-setting-in-fastcgi/</link>
		<comments>http://ruslany.net/2010/03/php-on-iis-monitorchangesto-setting-in-fastcgi/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 21:36:54 +0000</pubDate>
		<dc:creator>ruslany</dc:creator>
				<category><![CDATA[FastCGI]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://ruslany.net/?p=710</guid>
		<description><![CDATA[PHP on Windows loads its configuration file php.ini during the startup of the process php-cgi.exe. When PHP is run on IIS via FastCGI the php-cgi.exe processes are re-used to handle many requests. If configuration settings in php.ini file get updated, those changes will not be picked up by php-cgi.exe processes until the processes are recycled [...]]]></description>
			<content:encoded><![CDATA[<p>PHP on Windows loads its configuration file <em>php.ini</em> during the startup of the process <em>php-cgi.exe</em>. When PHP is run on IIS via FastCGI the <em>php-cgi.exe</em> processes are re-used to handle many requests. If configuration settings in <em>php.ini</em> file get updated, those changes will not be picked up by <em>php-cgi.exe</em> processes until the processes are recycled or restarted by IIS FastCGI module. This means that any time you change the PHP configuration you have to manually recycle IIS Application Pools that use PHP. This post explains how to configure FastCGI in IIS so that PHP configuration changes take effect right away without the need to manually recycle or restart the IIS Application Pools.<span id="more-710"></span></p>
<p>The latest releases of the <a href="http://ruslany.net/2010/01/fastcgi-extension-1-5-for-iis-5-1-and-iis-6-0-rtw/">FastCGI Extensoin 1.5</a> and <a href="http://ruslany.net/2010/03/important-update-for-iis-7-0-fastcgi-module/">FastCGI update for IIS 7.0</a> have a new configuration setting <strong>monitorChangesTo</strong> that takes an absolute path to a file that FastCGI will monitor for changes. In case of PHP this means that you can set <strong>monitorChangesTo</strong> to a path to <em>php.ini</em> file, so that any time it is modified the FastCGI module will restart the <em>php-cgi.exe</em> to pick up the configuration changes.</p>
<p>Assuming that the PHP configuration file location is <em>C:\PHP\php.ini</em>, the instructions below describe how to use <strong>monitorChangesTo</strong> on different IIS versions:</p>
<ul>
<li><a href="#iis6">IIS 5.1 and IIS 6.0</a></li>
<li><a href="#iis7">IIS 7.0</a></li>
<li><a href="#iis75">IIS 7.5</a></li>
</ul>
<h3 id="iis6">IIS 5.1 and IIS 6.0</h3>
<p>The FasCGI configuration is stored in a file <em>%windir%\system32\inetsrv\fcgiext.ini</em>. You can manually update it to use <strong>monitorChangesTo</strong>:</p>
<pre name="code" class="dos">
[Types]
php=PHP

[PHP]
ExePath=C:\PHP\php-cgi.exe
MonitorChangesTo=C:\PHP\php.ini
</pre>
<p>Alternatively you can use the configuration helper script <em>%windir%\system32\inetsrv\fcgiconfig.js</em> :</p>
<pre name="code" class="dos">
cscript %windir%\system32\inetsrv\fcgiconfig.js -set -section:PHP -MonitorChangesTo:C:\PHP\php.ini
</pre>
<h3 id="iis7">IIS 7.0</h3>
<p>You will need to install the <a href="http://ruslany.net/2010/03/important-update-for-iis-7-0-fastcgi-module/">FastCGI Update</a> in order to be able to use <strong>monitorChangesTo</strong> in IIS 7.0 on Windows Vista and Windows Server 2008.</p>
<p>To configure this setting, use the command below:</p>
<pre name="code" class="dos">
%windir%appcmd.exe set config -section:system.webServer/fastCgi ^
/[fullPath=&#039;C:\PHP\php-cgi.exe&#039;,arguments=&#039;&#039;].monitorChangesTo:&quot;C:\PHP\php.ini&quot; ^
/commit:apphost
</pre>
<h3 id="iis75">IIS 7.5</h3>
<p>In Windows 7 and Windows Server 2008 R2 you can use the same <strong>appcmd</strong> command as described above or you can use IIS Manager user interface for FastCGI settings:</p>
<p><a href="http://ruslany.net/wp-content/uploads/2010/03/MonitorChangesTo.png"><img class="alignnone size-medium wp-image-713 screenshot" title="MonitorChangesTo setting in IIS Manager" src="http://ruslany.net/wp-content/uploads/2010/03/MonitorChangesTo-478x500.png" alt="" width="478" height="500" /></a></p>
<h3>Technical Notes</h3>
<p>Below are the technical details that you need to be aware of when using this new feature in FastCGI module:</p>
<ul>
<li>The file that <strong>monitorChangesTo</strong> is pointing to must exist on a file system. If it does not exist then FastCGI module will generate an error;</li>
<li>If the file is located on a network share then FastCGI module cannot use Windows file change notifications so it will switch to polling and will check the file for changes every 5 seconds;</li>
<li>If a relative file path is specified instead of an absolute path then FastCGI will assume that it is relative to the location of <em>php-cgi.exe</em> file.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://ruslany.net/2010/03/php-on-iis-monitorchangesto-setting-in-fastcgi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Important update for IIS 7.0 FastCGI module</title>
		<link>http://ruslany.net/2010/03/important-update-for-iis-7-0-fastcgi-module/</link>
		<comments>http://ruslany.net/2010/03/important-update-for-iis-7-0-fastcgi-module/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 10:10:21 +0000</pubDate>
		<dc:creator>ruslany</dc:creator>
				<category><![CDATA[FastCGI]]></category>
		<category><![CDATA[IIS News Item]]></category>

		<guid isPermaLink="false">http://ruslany.net/?p=686</guid>
		<description><![CDATA[FastCGI module in IIS 7.0 has been lacking some of the features and bug fixes that are available in IIS 7.5 FastCGI module and in FastCGI Extension 1.5 on IIS 5.1 and IIS 6.0. The reason why this happened are explained in the post about FastCGI Module: Differences across IIS versions. This week IIS team [...]]]></description>
			<content:encoded><![CDATA[<p>FastCGI module in IIS 7.0 has been lacking some of the features and bug fixes that are available in IIS 7.5 FastCGI module and in FastCGI Extension 1.5 on IIS 5.1 and IIS 6.0. The reason why this happened are explained in the post about <a href="http://ruslany.net/2010/02/fastcgi-module-differences-across-iis-versions/">FastCGI Module: Differences across IIS versions</a>. This week IIS team has released an update for FastCGI module in IIS 7.0 that closes this remaining feature gap and ensures that FastCGI functionality is consistent across all versions of IIS.</p>
<p>The update can be downloaded from the following locations:</p>
<ul>
<li><a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=c17a72bd-7009-4830-85e0-06290f3b8367">Update for Windows Server 2008 (KB980363)</a></li>
<li><a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=e5a4e9c8-82f4-4154-b4ac-17af852131a6">Update for Windows Server 2008 for Itanium-based Systems (KB980363)</a></li>
<li><a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=14769ab6-c741-4598-bf32-5fc568d92159">Update for Windows Server 2008 x64 Edition (KB980363)</a></li>
<li><a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=c68659ec-18cb-45e1-94fd-61d86b0f34a1">Update for Windows Vista (KB980363)</a></li>
<li><a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=e2136abf-8cf3-42e6-8703-96f5516537d0">Update for Windows Vista for x64-based Systems (KB980363)</a></li>
</ul>
<p><span id="more-686"></span>The features that are enabled by this update:</p>
<ul>
<li><strong>Monitor changes to a file</strong>. The module can be configured to listen for file change notifications on a specific file and when that file changes, the module will recycle FastCGI processes for the process pool. This feature can be used to recycle PHP processes when changes to php.ini file occur. To enable this feature use the <strong><em>monitorChangesTo</em></strong> setting in the &lt;fastCgi&gt; configuration element.</li>
<li><strong>Real-time tuning of MaxInstances setting</strong>. This <strong><em>MaxInstances</em></strong> setting dictates the maximum number of FastCGI processes which can be launched for each application pool. Set it to 0 to let FastCGI module automatically adjust the number of instances up or down based on the system load and number of requests waiting in the queue.</li>
<li><strong>STDERR stream handling</strong>. There are several options of how the module can handle text sent by FastCGI application on STDERR. The module can send the error data as a failure response to the HTTP client or it can ignore the error and send whatever was received on STDOUT as a response with 200 status code. This behavior is controlled by the <strong><em>stderrMode</em></strong> setting.</li>
<li><strong>Sending a termination signal to FastCGI processes</strong>. The module can be configured to send a termination signal to FastCGI process before terminating it. This enables FastCGI processes to do a clean shutdown before getting killed. The <strong><em>signalBeforeTerminateSeconds</em></strong> setting can be used to specify how long the module will wait before it forcefully shuts down the FastCGI process that does not respond to the termination signal. This feature is disabled by default.</li>
<li><strong>_FCGI_X_PIPE_ environment variable</strong>. This variable is set by FastCGI module and it contains the name of the named pipe that is used for communication between the module and FastCGI process.</li>
<li><strong>Relaxed enforcement of response headers syntax</strong>. The FastCGI module now has less strict enforcements for the correctness of the response headers.</li>
<li><strong>Using UTF-8 encoding for server variable values</strong>. By default FastCGI uses ASCII encoding when setting server variables. If a FastCGI application requires UTF-8 encoded values for certain server variables, the module can be configured to use UTF-8 only for required server variables. Follow <a href="http://learn.iis.net/page.aspx/248/configure-the-fastcgi-extension-for-iis-60/#utf8servervars">these instructions</a> to enable this functionality.</li>
</ul>
<p>In addition to that several important bugs have been fixed, most notable of those are the ones reported by <a href="http://forums.iis.net/members/peaceable_5F00_whale.aspx">Franklin Tse</a>:</p>
<ul>
<li><a href="http://forums.iis.net/t/1158431.aspx">FastCGI module replaces redirect status code set by PHP with HTTP 302</a></li>
<li><a href="http://forums.iis.net/p/1157764/1904516.aspx#1904516">Custom application errors were masked by the generic IIS errors</a></li>
</ul>
<p>If you are using IIS 7.0 to host PHP applications, then it is highly recommended to apply this update to ensure you have the latest version of FastCGI module.</p>
]]></content:encoded>
			<wfw:commentRss>http://ruslany.net/2010/03/important-update-for-iis-7-0-fastcgi-module/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>FastCGI Module: Differences across IIS versions</title>
		<link>http://ruslany.net/2010/02/fastcgi-module-differences-across-iis-versions/</link>
		<comments>http://ruslany.net/2010/02/fastcgi-module-differences-across-iis-versions/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 20:25:50 +0000</pubDate>
		<dc:creator>ruslany</dc:creator>
				<category><![CDATA[FastCGI]]></category>

		<guid isPermaLink="false">http://ruslany.net/?p=651</guid>
		<description><![CDATA[The information in this post is not applicable anymore because the update for FastCGI module in IIS 7.0 has been made available, so now the functionality and features of FastCGI are consistent across all IIS versions. Read the release announcement to get more details about the update. Recent release of FastCGI Extension 1.5 for IIS [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>The information in this post is not applicable anymore because the update for FastCGI module in IIS 7.0 has been made available, so now the functionality and features of FastCGI are consistent across all IIS versions. Read the <a href="http://ruslany.net/2010/03/important-update-for-iis-7-0-fastcgi-module/">release announcement</a> to get more details about the update.</p></blockquote>
<p>Recent release of <a href="http://www.iis.net/expand/FastCGI">FastCGI Extension 1.5</a> for IIS 6.0 and IIS 5.1 has several <a href="http://ruslany.net/2010/01/fastcgi-extension-1-5-for-iis-5-1-and-iis-6-0-rtw/">new features and improvements</a> that make it easier to run PHP on Windows and IIS. However, all the new features are only available when using Windows XP or Windows Server 2003. FastCGI module on IIS 7.5 in Windows 7 and Windows Server 2008 R2 supports most of these features. FastCGI module on IIS 7 in Windows Vista and Windows Server 2008 does not support those new features yet. The reasons why this happens and the plan for updating FastCGI functionality across all platforms are explained in this post.<span id="more-651"></span></p>
<p>FastCGI is supported across 4 different versions of IIS: IIS 5.1/6.0, IIS 7.0 and IIS 7.5. The release models for each of those versions are different:</p>
<ul>
<li><strong>FastCGI Extension for IIS 5.1 and IIS 6.0</strong>: This is a separate add-on, which is shipped independently of IIS and Windows OS. IIS team has a lot of control over the release schedule and is able to release updates and fix bugs in the extension relatively fast. Thus the new FastCGI features were first introduces in this extension.</li>
<li><strong>FastCGI Module for IIS 7.0</strong>: The module is included in IIS and is therefore a part of the already shipped operating system. Updating the OS component, while possible, requires more time as the changes have to go through the standard Windows Servicing process.<span style="text-decoration: line-through;"> The update to the IIS 7.0 FastCGI Module that includes all the new FastCGI features is currently in the release stage and will soon be publicly available for download</span>. The update for the IIS 7.0 FastCGI Module has been <a href="http://ruslany.net/2010/03/important-update-for-iis-7-0-fastcgi-module/">released</a>.</li>
<li><strong>FastCGI Module for IIS 7.5</strong>: FastCGI module is included in IIS and is a part of the operating system. However, the development phase for IIS 7.5 coincided with the release of the FastCGI Extension 1.5 thus the majority (but not all) of the new FastCGI features are available in IIS 7.5. The remaining updates to the FastCGI Module for IIS 7.5 will be done in Windows Server 2008 R2 Service Pack.</li>
</ul>
<p>The following table lists the new FastCGI features and their availability in different versions of IIS:</p>
<table border="0" width="600">
<tbody>
<tr>
<th>Feature</th>
<th>IIS 5.1/6.0</th>
<th>IIS 7.0 *</th>
<th>IIS 7.5</th>
</tr>
<tr>
<td>Monitor Changes to File</td>
<td style="text-align: center;">yes</td>
<td style="text-align: center;"><span style="text-decoration: line-through;">no</span> YES</td>
<td style="text-align: center;">yes</td>
</tr>
<tr>
<td>Real-time tuning of MaxInstances</td>
<td style="text-align: center;">yes</td>
<td style="text-align: center;"><span style="text-decoration: line-through;">no</span> YES</td>
<td style="text-align: center;">yes</td>
</tr>
<tr>
<td>STDERR stream handling</td>
<td style="text-align: center;">yes</td>
<td style="text-align: center;"><span style="text-decoration: line-through;">no</span> YES</td>
<td style="text-align: center;">yes</td>
</tr>
<tr>
<td>Sending termination signal to FastCGI processes</td>
<td style="text-align: center;">yes</td>
<td style="text-align: center;"><span style="text-decoration: line-through;">no</span> YES</td>
<td style="text-align: center;">yes</td>
</tr>
<tr>
<td>_FCGI_X_PIPE_ environment variable</td>
<td style="text-align: center;">yes</td>
<td style="text-align: center;"><span style="text-decoration: line-through;">no</span> YES</td>
<td style="text-align: center;">yes</td>
</tr>
<tr>
<td>Relaxed enforcement of response headers syntax</td>
<td style="text-align: center;">yes</td>
<td style="text-align: center;"><span style="text-decoration: line-through;">no</span> YES</td>
<td style="text-align: center;">yes</td>
</tr>
<tr>
<td>Per-application FastCGI process pools</td>
<td style="text-align: center;">yes</td>
<td style="text-align: center;">YES</td>
<td style="text-align: center;">yes</td>
</tr>
<tr>
<td>Using UTF-8 encoding for server variable values</td>
<td style="text-align: center;">yes</td>
<td style="text-align: center;"><span style="text-decoration: line-through;">no</span> YES</td>
<td style="text-align: center;">no</td>
</tr>
<tr>
<td>IIS CPU Limits support</td>
<td style="text-align: center;">no</td>
<td style="text-align: center;">YES</td>
<td style="text-align: center;">yes</td>
</tr>
</tbody>
</table>
<p>* – Install the <a href="http://ruslany.net/2010/03/important-update-for-iis-7-0-fastcgi-module/">FastCGI update for IIS 7.0</a> to get all the features listed above.</p>
]]></content:encoded>
			<wfw:commentRss>http://ruslany.net/2010/02/fastcgi-module-differences-across-iis-versions/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>FastCGI Extension 1.5 for IIS 5.1 and IIS 6.0 &#8211; RTW</title>
		<link>http://ruslany.net/2010/01/fastcgi-extension-1-5-for-iis-5-1-and-iis-6-0-rtw/</link>
		<comments>http://ruslany.net/2010/01/fastcgi-extension-1-5-for-iis-5-1-and-iis-6-0-rtw/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 00:41:46 +0000</pubDate>
		<dc:creator>ruslany</dc:creator>
				<category><![CDATA[FastCGI]]></category>
		<category><![CDATA[IIS News Item]]></category>

		<guid isPermaLink="false">http://ruslany.net/?p=640</guid>
		<description><![CDATA[Today IIS team has released to web the FastCGI Extension 1.5 for IIS 6.0 and IIS 5.1. This version is based on FastCGI Extension 1.0 and it adds several important improvements and features. This is a production ready release that is officially supported by Microsoft. Install FastCGI Extension 1.5 for IIS 6.0 and IIS 5.1 [...]]]></description>
			<content:encoded><![CDATA[<p>Today IIS team has released to web the FastCGI Extension 1.5 for IIS 6.0 and IIS 5.1. This version is based on FastCGI Extension 1.0 and it adds several important improvements and features. This is a production ready release that is officially supported by Microsoft.</p>
<h3>Install FastCGI Extension 1.5 for IIS 6.0 and IIS 5.1</h3>
<p>To install the FastCGI Extension 1.5 use the download links at the extension&#8217;s home page at <a href="http://www.iis.net/expand/fastcgi">http://www.iis.net/expand/fastcgi</a>.</p>
<p><strong>Note</strong>: If you already have FastCGI v1.0, v1.5 Beta or v1.5 RC installed, then the installation package will upgrade it to version 1.5 &#8211; RTW. All the related IIS configuration and settings in fcgiext.ini file will be preserved during upgrade. Note that during upgrade from v1.0 the comments in fcgiext.ini will not be updated and will not mention new configuration settings. However the new settings can still be used after upgrade.</p>
<p><span id="more-640"></span></p>
<h3>New Features</h3>
<p>The FastCGI Extension 1.5 includes these new features:</p>
<ul>
<li><strong>Monitor changes to a file</strong>. The extension can be configured to listen for file change notifications on a specific file and when that file changes, the extension will recycle FastCGI processes for the process pool. This feature can be used to recycle PHP processes when changes to php.ini file occur.</li>
<li><strong>Real-time tuning of MaxInstances setting</strong>. This MaxInstances setting dictates the maximum number of FastCGI processes which can be launched for each application pool. If it is set to 0 then FastCGI extension will automatically adjust the number of instances up or down every few seconds based on the system load and number of requests waiting in the queue. </li>
<li><strong>STDERR stream handling</strong>. There are several options of how the extension can handle text sent by FastCGI application on STDERR. The extension can send the error data as a failure response to the HTTP client or it can ignore the error and send whatever was received on STDOUT as a response with 200 status code.</li>
<li><strong>Sending a termination signal to FastCGI processes</strong>. The extension can be configured to send a termination signal to FastCGI process before terminating it. This enables FastCGI processes to do a clean shutdown before getting killed.</li>
<li><strong>_FCGI_X_PIPE_ environment variable</strong>. This variable is set by FastCGI extension and it contains the name of the named pipe that is used for communication between the extension and FastCGI process.</li>
<li><strong>Relaxed enforcement of response headers syntax</strong>. The FastCGI extension has less strict enforcements for the correctness of the response headers.</li>
<li><strong>Per-application FastCGI process pools</strong>. In previous version of the extension, the FastCGI process pools could be defined for the entire IIS server or per IIS site. In FastCGI 1.5 it is also possible to define FastCGI process pool per IIS application, which allows to have two different PHP version used for different applications within the same web site.</li>
<li><strong>Using UTF-8 encoding for server variable values</strong>. By default FastCGI uses ASCII encoding when setting server variables. If a FastCGI application requires UTF-8 encoded values for certain server variables, the extension can be configured to use UTF-8 only for required server variables.</li>
<li><strong>More descriptive error messages</strong> are used when configuration in fcgiext.ini is incorrect</li>
<li><strong>Changes in default values for configuration settings</strong>. MaxInstances is now set to 0, so that real-time tuning of MaxInstances is enabled by default. ActivityTimeout is set to 70 seconds.</li>
</ul>
<h3>More information</h3>
<p>Refer to the following resources for more information</p>
<ul>
<li><a href="http://learn.iis.net/page.aspx/248/configuring-fastcgi-extension-for-iis60/">FastCGI Extension 1.5 configuration settings</a></li>
<li><a href="http://learn.iis.net/page.aspx/247/using-fastcgi-to-host-php-applications-on-iis-60/">Using FastCGI Extension to run PHP applications on IIS5.1 and 6.0</a></li>
<li><a href="http://php.iis.net">PHP community portal on IIS.NET </a></li>
</ul>
<p>Also, be sure to visit the <a title="FastCGI Handler Forum" href="http://forums.iis.net/1103.aspx" target="_blank">FastCGI Handler forum</a> on IIS.NET if you have run into any problems when using the extension or have questions or suggestions.</p>
]]></content:encoded>
			<wfw:commentRss>http://ruslany.net/2010/01/fastcgi-extension-1-5-for-iis-5-1-and-iis-6-0-rtw/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Multiple PHP versions on the same IIS server</title>
		<link>http://ruslany.net/2009/12/multiple-php-versions-on-the-same-iis-server/</link>
		<comments>http://ruslany.net/2009/12/multiple-php-versions-on-the-same-iis-server/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 20:45:38 +0000</pubDate>
		<dc:creator>ruslany</dc:creator>
				<category><![CDATA[FastCGI]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://ruslany.net/?p=613</guid>
		<description><![CDATA[This post describes how to configure IIS to support multiple versions of PHP on the same server. This kind of setup is useful in development environments where it is necessary to test an application with different PHP versions. Also, it is often used in production environments, where many PHP applications are hosted on the same server [...]]]></description>
			<content:encoded><![CDATA[<p>This post describes how to configure IIS to support multiple versions of PHP on the same server. This kind of setup is useful in development environments where it is necessary to test an application with different PHP versions. Also, it is often used in production environments, where many PHP applications are hosted on the same server and some of them have dependency on a particular PHP version.</p>
<p>In order to setup multiple versions of PHP side by side on the same IIS server it is necessary to install PHP manually by following the steps described in php.net documentation for <a title="Manual installation of PHP on IIS 5.1 and IIS 6.0" href="http://www.php.net/manual/en/install.windows.iis6.php" target="_blank">IIS 5.1 and IIS 6.0</a> and for <a title="Manual installation of PHP on IIS 7.0 and beyond" href="http://www.php.net/manual/en/install.windows.iis7.php" target="_blank">IIS 7.0 and later</a>. Do not use PHP Windows installer because it does not support side by side installations.<span id="more-613"></span></p>
<p>After a particular version of PHP has been installed in accordance to the instructions, download another version of PHP, extract it into a separate directory and configure it in accordance to <a title="PHP Manual Installation Steps." href="http://www.php.net/manual/en/install.windows.manual.php" target="_blank">Manual Installation Steps</a>. After that proceed to configuring an IIS server as per instructions below:</p>
<ul>
<li><a href="#iis51">IIS 5.1</a></li>
<li><a href="#iis60">IIS 6.0</a></li>
<li><a href="#iis70">IIS 7.0 and later</a></li>
</ul>
<p><strong>Note</strong>: in all examples below two PHP versions are installed on the same server. PHP 5.2.11 files are located in C:\PHP5211\ directory and PHP 5.3.1 files are located in C:\PHP531\ directory.</p>
<h3 id="iis51">IIS 5.1</h3>
<p>The FastCGI Extension can be configured on a server and a site level. Since IIS 5.1 can have only one web site, it is not possible to configure it to have two versions of PHP running at the same time. But it is possible to have a configuration that allows to easily switch from one version to another.</p>
<p>Open the IIS FastCGI extension configuration file at %windir%\system32\inetsrv\fcgiext.ini. At the end of the file there will be a section that defines FastCGI applications. It may look similar to this:</p>
<pre name="code" class="dos">
[Types]
php=php5211

[php5211]
ExePath=C:\php5211\php-cgi.exe
</pre>
<p>This configures IIS to use PHP 5.2.11 whenever a request for a *.php file is made. To switch to PHP 5.3.1, just add another section declaration and then modify the [Types] section as below:</p>
<pre name="code" class="dos">
[Types]
;php=php5211
php=php531

[php5211]
ExePath=C:\php5211\php-cgi.exe

[php531]
ExePath=C:\php531\php-cgi.exe
</pre>
<p>To switch back to PHP 5.2.11 update the <em>[Types]</em> section by commenting out <em>php=php531</em> and un-commenting <em>php=php5211</em>. There is no need to restart IIS after the updates to fcgiexe.ini have been made. FastCGI Extension will pick up the changes as soon as file has been saved.</p>
<h3 id="iis60">IIS 6.0</h3>
<p>FastCGI on IIS 6.0 can be configured on a server level, which would cause all the IIS web sites to use the same PHP version. Configuring FastCGI on a server level and switching between PHP versions is exactly the same procedure as for <a href="#iis51">IIS 5.1</a>.</p>
<p>Additionally FastCGI can be configured on a site level, which would allow using of different PHP versions for different web sites. To assign a particular PHP version to a site, use the following commands. Make sure to replace the <em>&lt;site_id&gt;</em> with real site identifiers.</p>
<pre name="code" class="dos">
cscript %windir%\system32\inetsrv\fcgiconfig.js -add -section:&quot;php5211&quot; ^
-extension:php -path:&quot;C:\php5211\php-cgi.exe&quot; -site:&lt;site_id&gt;

cscript %windir%\system32\inetsrv\fcgiconfig.js -add -section:&quot;php531&quot; ^
-extension:php -path:&quot;C:\php531\php-cgi.exe&quot; -site:&lt;site_id&gt;
</pre>
<p>After executing these commands open the fcgiext.ini file located in %WINDIR%\system32\inetsrv. It should contain the following sections:</p>
<pre name="code" class="dos">
[Types]
php:169297538=php5211 ; The actual site id will be different for your site
php:273357939=php531 ; The actual site id will be different for your site

[php5211]
ExePath=C:\php5211\php-cgi.exe

[php531]
ExePath=C:\php531\php-cgi.exe
</pre>
<h2 id="iis70">IIS 7.0 and later</h2>
<p>FastCGI module in IIS 7.0 can be configured on any level: server, site, application and folder. This means that it is even possible to have two applications using different PHP versions within the same web site.</p>
<p>To configure FastCGI on a server level, use these commands:</p>
<pre name="code" class="dos">
%windir%\system32\inetsrv\appcmd set config /section:system.webServer/fastCGI ^
/+[fullPath=&#039;c:\php531\php-cgi.exe&#039;]

%windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers ^
/+[name=&#039;php531&#039;, path=&#039;*.php&#039;,verb=&#039;*&#039;,modules=&#039;FastCgiModule&#039;,^
scriptProcessor=&#039;c:\php531\php-cgi.exe&#039;,resourceType=&#039;Either&#039;]
</pre>
<p>Repeat these commands for all the other versions of PHP. By default IIS will use the version that was added last. Now, if you need to use a particular version of PHP for the entire server or for a particular web site, you can just re-order the FastCGI handler mappings for PHP.</p>
<p>Open IIS Manager and use a tree view on left hand side to select a server, site or an application. After that click on “Handler Mappings”:</p>
<p> <a href="http://ruslany.net/wp-content/uploads/2009/12/HandlerMapping.png"><img class="alignnone size-medium wp-image-626 screenshot" title="IIS Handler Mapping" src="http://ruslany.net/wp-content/uploads/2009/12/HandlerMapping-500x348.png" alt="IIS Handler Mapping" width="500" height="348" /></a></p>
<p>Then click on “View Ordered List…” action:</p>
<p> <a href="http://ruslany.net/wp-content/uploads/2009/12/ViewOrderedList.png"><img class="alignnone size-medium wp-image-627 screenshot" title="View Ordered List" src="http://ruslany.net/wp-content/uploads/2009/12/ViewOrderedList-500x348.png" alt="View Ordered List" width="500" height="348" /></a></p>
<p>Select the handler mapping for the PHP version that you want to use for the server or a site and use “Move Up” action to move it to the top of the list. This will enable that particular PHP version for the currently selected IIS configuration scope.</p>
<p> <a href="http://ruslany.net/wp-content/uploads/2009/12/ReorderHandlerMapping.png"><img class="alignnone size-medium wp-image-628 screenshot" title="Reorder Handler Mapping" src="http://ruslany.net/wp-content/uploads/2009/12/ReorderHandlerMapping-500x348.png" alt="Reorder Handler Mapping" width="500" height="348" /></a></p>
<p>Note that if you re-order handler mappings on a site or an application level, that site or application will stop inheriting the handler mappings from the upper configuration levels, so the changes to the handler mappings on the server level will not propagate to the site level anymore. To configure a site or an application back to using the inherited handler mappings, use the “Revert To Parent…” action:</p>
<p><a href="http://ruslany.net/wp-content/uploads/2009/12/RevertToParent1.png"><img class="alignnone size-medium wp-image-631 screenshot" title="Revert To Parent" src="http://ruslany.net/wp-content/uploads/2009/12/RevertToParent1-500x348.png" alt="Revert To Parent" width="500" height="348" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://ruslany.net/2009/12/multiple-php-versions-on-the-same-iis-server/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>IIS Documentation Updates on PHP.NET</title>
		<link>http://ruslany.net/2009/11/iis-documentation-updates-on-php-net/</link>
		<comments>http://ruslany.net/2009/11/iis-documentation-updates-on-php-net/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 19:18:44 +0000</pubDate>
		<dc:creator>ruslany</dc:creator>
				<category><![CDATA[FastCGI]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://ruslany.net/?p=599</guid>
		<description><![CDATA[PHP.NET web site is known for its well written and very detailed documentation. The excellent content together with tons of user contributed notes has made the PHP.NET the primary place for getting the help on all PHP related questions. However there was one thing in the PHP docs that was still not up-to-date. The Windows [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.php.net/manual/en/" target="_blank">PHP.NET</a> web site is known for its well written and very detailed documentation. The excellent content together with tons of user contributed notes has made the PHP.NET the primary place for getting the help on all PHP related questions.</p>
<p>However there was one thing in the PHP docs that was still not up-to-date. The Windows and IIS-specific installation and configuration sections did not cover the latest changes in Windows, such as IIS 7 and FastCGI. Now I am glad to let everyone know that this part of the PHP documentation is also being updated!</p>
<p>Check out the first batch of updates:</p>
<ul>
<li><a href="http://www.php.net/manual/en/install.windows.manual.php" target="_blank">Manual Installation Steps</a></li>
<li><a href="http://www.php.net/manual/en/install.windows.iis6.php" target="_blank">Microsoft IIS 5.1 and IIS 6.0</a></li>
<li><a href="http://www.php.net/manual/en/install.windows.iis7.php" target="_blank">Microsoft IIS 7.0 and later</a></li>
</ul>
<p>The content is still being updated and there are plans to add more instructions, such as how to install <a href="http://blogs.iis.net/donraman/archive/2009/10/07/installing-php-on-windows.aspx" target="_blank">PHP on Windows with PHP Installer</a>, how to <a href="http://blogs.iis.net/donraman/archive/2009/10/08/upgrading-to-php-5-3-an-easy-way.aspx" target="_blank">easily upgrade to PHP 5.3</a>, how to run multiple <a href="http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis-70/#PHP_Versioning" target="_blank">PHP versions side by side</a>, etc. If you have any suggestions on the updated content or if you have any additional instructions that you think will be useful, please submit user notes on <a href="http://docs.php.net/manual/en/install.windows.php">PHP.NET</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://ruslany.net/2009/11/iis-documentation-updates-on-php-net/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Windows Cache Extension for PHP and CPU usage</title>
		<link>http://ruslany.net/2009/09/windows-cache-extension-for-php-and-cpu-usage/</link>
		<comments>http://ruslany.net/2009/09/windows-cache-extension-for-php-and-cpu-usage/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 00:17:49 +0000</pubDate>
		<dc:creator>ruslany</dc:creator>
				<category><![CDATA[FastCGI]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WinCache]]></category>

		<guid isPermaLink="false">http://ruslany.net/?p=538</guid>
		<description><![CDATA[The FastCGI module in IIS has a configuration setting maxInstances, which controls the number of concurrently running php-cgi.exe processes that IIS creates to process PHP requests. To achieve optimal performance, it is recommended to fine tune this setting for your specific environment starting with 8-10 instances per CPU core (e.g. maxInstances=32 for quad-core CPU). The [...]]]></description>
			<content:encoded><![CDATA[<p>The FastCGI module in IIS has a configuration setting <strong><a href="http://www.iis.net/ConfigReference/system.webServer/fastCgi/application" target="_blank">maxInstances</a></strong>, which controls the number of concurrently running <strong>php-cgi.exe</strong> processes that IIS creates to process PHP requests. To achieve optimal performance, it is recommended to fine tune this setting for your specific environment starting with 8-10 instances per CPU core (e.g. maxInstances=32 for quad-core CPU).</p>
<p>The <a href="http://www.iis.net/extensions/WinCacheForPHP" target="_blank">Windows Cache Extension for PHP</a> can be used to improve performance of PHP applications running on Windows operating systems. The extension caches the compiled PHP opcode in the shared memory, which helps to avoid re-doing of such CPU intensive operations as parsing and compiling of the PHP source code. This means that when Windows Cache Extension for PHP is enabled, less CPU cycles are required for a web server to process PHP requests. Because of that, the previously configured value for the FastCGI maxInstances setting may not be adequate to load the server’s CPU completely and it may be necessary to increase the value further.<span id="more-538"></span></p>
<p>To increase the maxInstances value on IIS 7 run this command from an elevated command line prompt:</p>
<pre name="code" class="dos">
appcmd.exe set config  -section:system.webServer/fastCgi /[fullPath=&#039;C:\PHP\php-cgi.exe&#039;,arguments=&#039;&#039;].maxInstances:&quot;32&quot;  /commit:apphost
</pre>
<p><strong>Note</strong>: replace the fullPath with the path to php-cgi.exe on your server.</p>
<p>Alternatively you can just edit the &lt;fastCGI&gt; section the <strong>applicationHost.config</strong> file located at <strong>C:\Windows\System32\inetsrv\config\</strong> folder:</p>
<pre name="code" class="xml">
&lt;fastCgi&gt;
  &lt;application fullPath=&quot;C:\PHP\php-cgi.exe&quot; maxInstances=&quot;32&quot;&gt;
  &lt;!-- Some other settings may go here--&gt;
  &lt;/application&gt;
&lt;/fastCgi&gt;
</pre>
<p>To increate the maxInstances value on IIS 5.1 and IIS 6.0 run this command:</p>
<pre name="code" class="dos">
&gt;cscript C:\windows\system32\inetsrv\fcgiconfig.js -set -section:&quot;PHP&quot; –MaxInstances:32
</pre>
<p><strong>Note</strong>: replace the section name if necessary.</p>
<p>Alternatively you can edit the <strong>fcgiext.ini</strong> file located at <strong>C:\Windows\System32\inetsrv\</strong> folder:</p>
<pre name="code" class="dos">
[PHP]
ExePath=C:\PHP\php-cgi.exe
;some other settings may go here
MaxInstances=32
</pre>
<p>When you measure the performance of the Windows Cache Extension for PHP, make sure to monitor the CPU usage. If you see that CPU is not fully utilized try increasing the FastCGI maxInstances setting and you may be able to get better performance results.</p>
]]></content:encoded>
			<wfw:commentRss>http://ruslany.net/2009/09/windows-cache-extension-for-php-and-cpu-usage/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Windows Cache Extension 1.0 for PHP &#8211; Beta</title>
		<link>http://ruslany.net/2009/09/windows-cache-extension-1-0-for-php-beta/</link>
		<comments>http://ruslany.net/2009/09/windows-cache-extension-1-0-for-php-beta/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 17:10:37 +0000</pubDate>
		<dc:creator>ruslany</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[FastCGI]]></category>
		<category><![CDATA[IIS News Item]]></category>

		<guid isPermaLink="false">http://ruslany.net/?p=528</guid>
		<description><![CDATA[Today IIS team has released the beta of the Windows Cache Extension 1.0 for PHP. The Windows Cache Extension for PHP is a PHP accelerator, that is used to increase the speed of PHP applications running on the Windows operating systems. Any PHP application can take advantage of the functionality provided by the Windows Cache [...]]]></description>
			<content:encoded><![CDATA[<p>Today IIS team has released the beta of the <a title="Windows Cache Extension for PHP on IIS.NET" href="http://www.iis.net/extensions/WinCacheForPHP" target="_blank">Windows Cache Extension 1.0 for PHP</a>. The Windows Cache Extension for PHP is a <a href="http://en.wikipedia.org/wiki/PHP_accelerator">PHP accelerator</a>, that is used to increase the speed of PHP applications running on the Windows operating systems. Any PHP application can take advantage of the functionality provided by the Windows Cache Extension for PHP without any code modifications. All that is required is that the extension is enabled and loaded by the PHP engine.</p>
<h3>Install the Windows Cache Extension 1.0 for PHP &#8211; Beta</h3>
<p><a href="http://www.microsoft.com/web/gallery/install.aspx?appsxml=www.microsoft.com%2Fweb%2Fwebpi%2F2.0%2FWebProductList.xml%3Bwww.microsoft.com%2Fweb%2Fwebpi%2F2.0%2FWebProductList.xml&amp;appid=939%3B949"><img class="alignnone size-full wp-image-439" style="border: 0px;" title="wpibadgesilver" src="http://ruslany.net/wp-content/uploads/2009/07/wpibadgesilver.png" alt="wpibadgesilver" width="176" height="51" /></a></p>
<p>or, download:</p>
<p><a href="http://sourceforge.net/projects/wincache/files/wincache-1.1.0/wincache-1.1.0-5.2-nts-vc6-x86.exe/download" target="_blank">Windows Cache Extension 1.0 for PHP 5.2 &#8211; Beta</a></p>
<p><a href="http://sourceforge.net/projects/wincache/files/wincache-1.1.0/wincache-1.1.0-5.3-nts-vc9-x86.exe/download" target="_blank">Windows Cache Extension 1.0 for PHP 5.3 &#8211; Beta</a></p>
<p>Follow the instructions at &#8220;<a href="http://learn.iis.net/page.aspx/678/using-windows-cache-extension-for-php/">Using Windows Cache Extension for PHP</a>&#8221; to install, enable and configure the extension.<span id="more-528"></span></p>
<p><strong>Note:</strong></p>
<ul>
<li>The extension can only be used with non-thread-safe builds of PHP</li>
<li>The extension can only be used when IIS is configured to run PHP via FastCGI</li>
<li>The Windows Cache Extension 1.0 for PHP 5.3 can only be used with the x86 VC9 build of PHP 5.3.</li>
</ul>
<h3>Benefits and Features</h3>
<p>The extension includes three caches that can be enabled or disabled independently of each other:</p>
<ul>
<li><strong>PHP opcode cache</strong> &#8211; PHP is a script processing engine, which reads an input stream of data that contains text and/or PHP instructions and produces another stream of data, most commonly in the HTML format. This means that on a web server the PHP engine reads, parses, compiles and executes a PHP script each time that it is requested by a Web client. The reading, parsing and compilation operations put additional load on the web server&#8217;s CPU and file system and thus affect the overall performance of a PHP web application. The PHP bytecode (opcode) cache is used to store the compiled script bytecode in shared memory so that it can be re-used by PHP engine for subsequent executions of the same script.</li>
<li><strong>File cache</strong> &#8211; Even with the PHP bytecode cache enabled, the PHP engine has to access the script files on a file system. When PHP scripts are stored on a remote UNC file share, the file operations introduce a significant performance overhead. The Windows Cache Extension for PHP includes a file cache that is used to store the content of the PHP script files in shared memory, which reduces the amount of file system operations performed by PHP engine.</li>
<li><strong>Relative file path cache</strong> &#8211; PHP scripts very often include or operate with files by using relative file paths. Every relative file path has to be converted to an absolute file path by the PHP engine. When a PHP application uses many PHP files and accesses them by relative paths, the operation of resolving relative paths to absolute paths may negatively impact the application&#8217;s performance. The Windows Cache Extension for PHP provides a relative file path cache, which is used to store the mappings between relative and absolute file paths, thereby reducing the number of relative path resolutions that the PHP engine has to perform.</li>
</ul>
<h3>More information</h3>
<ul>
<li><a href="http://www.iis.net/extensions/WinCacheForPHP" target="_blank">Windows Cache Extension for PHP on IIS.NET</a></li>
<li><a href="http://learn.iis.net/page.aspx/678/using-windows-cache-extension-for-php/" target="_blank">Using Windows Cache Extension for PHP</a></li>
</ul>
<p>Use the <a href="http://forums.iis.net/1164.aspx">Windows Cache Extension for PHP Forum</a> to ask questions, report bugs and provide feature suggestions.</p>
]]></content:encoded>
			<wfw:commentRss>http://ruslany.net/2009/09/windows-cache-extension-1-0-for-php-beta/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Per-site PHP configuration with PHP 5.3 and IIS</title>
		<link>http://ruslany.net/2009/07/per-site-php-configuration-with-php-5-3-and-iis/</link>
		<comments>http://ruslany.net/2009/07/per-site-php-configuration-with-php-5-3-and-iis/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 07:05:27 +0000</pubDate>
		<dc:creator>ruslany</dc:creator>
				<category><![CDATA[FastCGI]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://ruslany.net/?p=428</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>About a year ago I wrote an article about how to enable <a href="http://ruslany.net/2008/07/per-site-php-configuration-with-iis-fastcgi/">per-site PHP configuration on IIS with FastCGI</a>. 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 <a href="http://pecl.php.net/package/htscanner">the htscanner extension for PHP</a>). Now, with <a href="http://www.php.net/archive/2009.php#id2009-06-30-1">PHP 5.3 final release available</a>, 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.<span id="more-428"></span></p>
<p>Assume that you have two web sites in IIS – website1.com and website2.com. The root directory for website1.com is at <strong>C:\Inetpub\website1.com\</strong> and the root directory for website2.com is <strong>C:\Inetpub\website2.com\</strong> . Let’s say that the PHP application at website1.com does some heavy database activity and hence requires longer script execution time, which in PHP is controlled by <strong>max_execution_time</strong> setting. Also, let’s say that the PHP application at website2.com is a photo album, where visitors may upload very large image files. Because of that it requires bigger maximum allowed file upload size, which is controlled by the php.ini setting <strong>upload_max_filesize</strong>.</p>
<p>To enable the above described scenario on IIS, first you need to install PHP 5.3 and configure IIS to work with it. The easiest way is to use PHP Installer available at the <a href="http://windows.php.net/download/">community PHP site</a>. Make sure to use the installer for VC9 non-thread-safe build of PHP 5.3 and choose the “IIS FastCGI” option during the installation. Alternatively, you can follow the instructions described in <a href="http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis-70/">Using FastCGI to Host PHP Applications on IIS 7.0</a> and create the FastCGI handler/script mapping on the server level, so that it applies to all web sites on the server.</p>
<p>Now you have two options:</p>
<ol>
<li>Define the per-site PHP settings in the main php.ini file</li>
<li>Allow web application owners to define those settings in user defined INI files.</li>
</ol>
<p>For option #1 open the main php.ini file (if you used PHP installer, then this file will most probably be located at C:\Program Files\PHP\ folder. If you installed from a ZIP archive then the file will be at the same directory where php-cgi.exe file is). Add the following at the end of the file:</p>
<pre name="code" class="dos">
[PATH=C:/inetpub/website1.com/]
max_execution_time = 300

[PATH=C:/inetpub/website2.com/]
upload_max_filesize = 12M
</pre>
<p>Save the php.ini file and then recycle the application pools for these web sites for the php.ini changes to take effect.</p>
<p>After that you can use phpinfo() or ini_get(‘max_execution_time’) to check that these settings overwrite the default ones:</p>
<p><a href="http://ruslany.net/wp-content/uploads/2009/07/phpinfo1.png"><img class="alignnone size-medium wp-image-430 screenshot" title="max_execution_time set correctly" src="http://ruslany.net/wp-content/uploads/2009/07/phpinfo1-500x305.png" alt="max_execution_time set correctly" width="500" height="305" /></a></p>
<p>The output shows that the local value of max_execution_time setting (in the second column) is 300, while the master value, or default, is 30.</p>
<p>Alternatively, if you want to allow web application owners to control PHP settings themselves, you can enable user defined PHP configuration. To do that, add the following setting to main php.ini file:</p>
<pre name="code" class="dos">
user_ini.filename = .user.ini
</pre>
<p>This setting specifies the name to be used for user-specific ini files. Setting this to empty value disables the user defined PHP configuration.</p>
<p>After that create a file called .user.ini in C:\inetpub\website1.com\ folder and place and put this line into it:</p>
<pre name="code" class="dos">
max_execution_time = 300
</pre>
<p>Also, put this line into the file .user.ini in C:\inetpub\website2.com\ folder:</p>
<pre name="code" class="dos">
upload_max_filesize = 12M
</pre>
<p>Note that if your main php.ini file has [PATH] sections that point to the root folders of these sites, then you need to remove those sections; otherwise user defined settings will not take effect.</p>
<p>Again, you can use phpinfo() or ini_get() functions to check that the user defined settings overwrite the default ones:</p>
<p><a href="http://ruslany.net/wp-content/uploads/2009/07/phpinfo2.png"><img class="alignnone size-medium wp-image-431 screenshot" title="upload_max_filesize set correctly" src="http://ruslany.net/wp-content/uploads/2009/07/phpinfo2-500x305.png" alt="upload_max_filesize set correctly" width="500" height="305" /></a></p>
<p>One more thing that you need to be aware of when you enable the user defined ini files is that the settings in those files are cached by PHP engine to avoid re-reading those files for every request. This means that if the user makes a change to .user.ini file then that change may not take effect right away. Instead it may take effect after the cache time-to-live has expired. The cache TTL value is controlled by the php.ini setting <strong>user_ini.cache_ttl</strong>, which is set to 300 seconds (5 minutes) by default.</p>
]]></content:encoded>
			<wfw:commentRss>http://ruslany.net/2009/07/per-site-php-configuration-with-php-5-3-and-iis/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
