<?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>JimmyLi.net &#187; FastCGI</title>
	<atom:link href="http://jimmyli.net/tag/fastcgi/feed/" rel="self" type="application/rss+xml" />
	<link>http://jimmyli.net</link>
	<description></description>
	<lastBuildDate>Thu, 04 Aug 2011 21:40:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>IIS Tutorial Series (Part 1): Installing FastCGI and PHP for IIS 6.0</title>
		<link>http://jimmyli.net/2010/02/installing-fastcgi-and-php-for-iis-6-0/</link>
		<comments>http://jimmyli.net/2010/02/installing-fastcgi-and-php-for-iis-6-0/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 06:40:00 +0000</pubDate>
		<dc:creator>Jimmy</dc:creator>
				<category><![CDATA[IIS Tutorial Series]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[FastCGI]]></category>
		<category><![CDATA[IIS]]></category>

		<guid isPermaLink="false">http://jimmyli.net/?p=63</guid>
		<description><![CDATA[Beginning from PHP 5.3, PHP can only be installed on IIS via a CGI Handler, and no longer through ISAPI. In this tutorial, we'll step through the details of how to set up FastCGI and PHP on IIS.]]></description>
			<content:encoded><![CDATA[<p>Note: This article is Part 1 of the <a href="/iis-tutorial-series/">IIS Tutorial Series</a>.</p>
<p>Despite IIS 7.5 being the current stable IIS release, it is only available for servers running Windows Server 2008. However for the many of us who are still running Windows Server 2003 or Windows XP, IIS 6.0 is our only option. And many of us are still limited to that option.</p>
<p>In this tutorial I will be doing a walkthrough on installing FastCGI and PHP. For those who are a bit new to PHP on IIS, here&#8217;s a general view of what happens when a PHP page is call through the client&#8217;s web browser:<br />
When the client requests a PHP resource (.php), IIS responds by calling FastCGI. FastCGI is the interface to CGI Programs (in this case, PHP), so the web server can focus on web page requests. FastCGI is then responsible for calling the PHP executable to execute the PHP script, and return its response back to IIS. IIS then returns that response back to the client.</p>
<p><span style="text-decoration: underline;"><strong>Installing FastCGI</strong></span><br />
With the stable release of PHP 5.3 out for a while now, the only way to install PHP 5.3 on IIS is through a CGI Handler. PHP 5.2 and earlier allowed us to run PHP using ISAPI, but that option has been deprecated. For those of us intending to move forward, we would have to use CGI from now on.  We&#8217;ll go over installing the <a href="http://en.wikipedia.org/wiki/FastCGI" target="_blank">FastCGI</a> handler on IIS 6.0.</p>
<p>You can download FastCGI for IIS 6.0 <a href="http://www.iis.net/download/FastCGI" target="_blank">here</a> (version 1.5 as of this time).</p>
<p>Run the executable on the web server to install FastCGI. You may have to restart your machine for the installation to complete. When that&#8217;s done, open up IIS Manager and view the list of Web Service Extensions on the server tree. There should be a &#8220;FastCGI Handler&#8221; extension in the list. Make sure its status is set to <em>Allowed</em>. And that&#8217;s it. FastCGI is installed!</p>
<p style="text-align: center;"><a href="http://jimmyli.net/wp/wp-content/uploads/2010/02/web_service_extensions.png" target="_blank"><img class="aligncenter size-medium wp-image-69" title="Web Service Extensions" src="http://jimmyli.net/wp/wp-content/uploads/2010/02/web_service_extensions-300x170.png" alt="" width="300" height="170" /></a></p>
<p><span style="text-decoration: underline;"><strong>Installing PHP</strong></span><br />
Download the latest version of PHP for Windows <a href="http://windows.php.net/download/" target="_blank">here</a>.<br />
We&#8217;ll be doing the manual method of installation, so download the ZIP version and which is <em>Non Thread Safe</em>. It&#8217;s completely up to you whether you want to use the PHP 5.2 series or the PHP 5.3 series. Some applications may work on PHP 5.2 but not 5.3. Either one, the installation process is the same.</p>
<p>Unzip the content to somewhere on your server. I prefer the base of the C drive: C:\php\<br />
Rename the &#8220;php.ini-recommended&#8221; (or &#8220;php.ini-production&#8221; or &#8220;php.ini-development&#8221;, depending on the version of PHP) file to the name &#8220;php.ini&#8221; and make any adjustments to that configuration file. (I won&#8217;t go over that in this tutorial.) You can do this at a later time if you wish. Just like that, PHP is technically &#8220;installed&#8221; on your server.</p>
<p><span style="text-decoration: underline;"><strong>Making PHP work</strong></span><br />
Now, it&#8217;s time to make IIS understand what to do with requests that have the .php extension. When IIS hear a .php file called, we want it to let FastCGI know, so FastCGI can call PHP. To do so, we&#8217;ll have to set up the extension mapping for .php. Open up IIS Manager again and navigate to &#8220;Web Sites&#8221;. Right-click on it and select &#8220;Properties&#8221;. Select the &#8220;Home Directory&#8221; tab, and within it, select &#8220;Configuration&#8230;&#8221; A new window pops up with a listing of Application Extensions.</p>
<p style="text-align: center;"><a href="http://jimmyli.net/wp/wp-content/uploads/2010/02/application_extensions.png" target="_blank"><img class="aligncenter size-medium wp-image-76" title="Application Extensions" src="http://jimmyli.net/wp/wp-content/uploads/2010/02/application_extensions-271x300.png" alt="" width="271" height="300" /></a></p>
<p>Look for the .php extension and &#8220;Edit&#8230;&#8221; it. If it doesn&#8217;t exist, &#8220;Add&#8230;&#8221; the extension. A new windows pops up. For Executable, look for the FastCGI library. For most default installs, it should be under: C:\WINDOWS\system32\inetsrv\fcgiext.dll<br />
For Verbs, limit it to: GET,POST,HEAD<br />
Save all options.</p>
<p style="text-align: center;"><a href="http://jimmyli.net/wp/wp-content/uploads/2010/02/application_extension_mapping.png" target="_blank"><img class="aligncenter size-medium wp-image-77" title="Application Extension Mapping" src="http://jimmyli.net/wp/wp-content/uploads/2010/02/application_extension_mapping-300x169.png" alt="" width="300" height="169" /></a></p>
<p>IIS can request the FastCGI Executable when a .php resource is requested. Now, it&#8217;s time for FastCGI to talk to PHP by modifying FastCGI&#8217;s configuration file. For default installs, the config file should be located at: C:\WINDOWS\system32\inetsrv\fcgiext.ini<br />
Open it in a text editor and add the following at the bottom:</p>
<pre class="brush: plain; title: ; notranslate">[Types]
php=PHP

[PHP]
ExePath=c:\php\php-cgi.exe</pre>
<p>The <em>Types</em> is the extensions it&#8217;s listening to and the corresponding configuration it will use. So here a &#8220;php&#8221; extention will use the [PHP] configuration. The [PHP] configuration has the path to PHP&#8217;s CGI executable. This is how FastCGI knows where to find PHP. Modify the path to where PHP is located on your server.<br />
There are more options you can add, but this should get you going.</p>
<p><span style="text-decoration: underline;"><strong>Testing the Installation</strong></span><br />
Test that the installation went successfully. Restart IIS and create a website hosting a PHP file and output <a href="http://php.net/manual/en/function.phpinfo.php" target="_blank">phpinfo()</a>. If everything went well, you should see the PHP Info page with hints of FastCGI being used in there.</p>
<p style="text-align: center;"><a href="http://jimmyli.net/wp/wp-content/uploads/2010/02/phpinfo.png" target="_blank"><img class="aligncenter size-medium wp-image-78" title="PHP Info" src="http://jimmyli.net/wp/wp-content/uploads/2010/02/phpinfo-300x165.png" alt="" width="300" height="165" /></a></p>
<p><strong>Note:</strong> When I was doing this, I&#8217;ve also experienced a FastCGI error during this last step stating that &#8220;Access is denied&#8221;. I&#8217;m not sure if this is common, but I was able to fix the issue by adjusting the security permissions on the PHP installation folder. I make sure that the users: <em>Administrators</em>, <em>NETWORK SERVICE</em> and <em>SYSTEM</em> are listed. If not, add them, restart IIS, and try to load the PHP page again.</p>
]]></content:encoded>
			<wfw:commentRss>http://jimmyli.net/2010/02/installing-fastcgi-and-php-for-iis-6-0/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
	</channel>
</rss>

