<?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; IIS</title>
	<atom:link href="http://jimmyli.net/tag/iis/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.2</generator>
		<item>
		<title>IIS Tutorial Series (Part 4): Task Scheduling on Windows (Cron)</title>
		<link>http://jimmyli.net/2010/08/task-scheduling-on-windows/</link>
		<comments>http://jimmyli.net/2010/08/task-scheduling-on-windows/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 01:58:57 +0000</pubDate>
		<dc:creator>Jimmy</dc:creator>
				<category><![CDATA[IIS Tutorial Series]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[task scheduling]]></category>

		<guid isPermaLink="false">http://jimmyli.net/?p=143</guid>
		<description><![CDATA[For web developers, sometimes it is necessary to run a re-occurring task on the web server, such as sending out emails for notifications, or doing a periodic update without interaction from the client. On UNIX-like Operating Systems, the well-known Cron is a simple to use option, on Windows, it's Task Scheduler. In this tutorial, I will step through the process of setting up a scheduled task to have a web script executed periodically.]]></description>
			<content:encoded><![CDATA[<p>Note: This article is Part 4 of the <a href="/iis-tutorial-series/">IIS Tutorial Series</a>. Although this article does not relate to IIS, IIS is probably the primary web server the user reading this article is using.</p>
<p>Running a re-occurring task on a web server on a periodic basis without interaction from the client is sometimes necessary. Such as to send a daily notification email, or run a statistic processor. UNIX-like Operating Systems have the well-known Cron as a simple option. On Windows, it&#8217;s Task Scheduler. In this tutorial, I will step through the process of setting up a scheduled task to have a web script executed periodically. It&#8217;s also important that you have a Windows User login with a password that the task can execute under.  For this tutorial, here&#8217;s an overview of how the task execution process will work:</p>
<ol>
<li>A task scheduler is set up to run once every day.</li>
<li>The task is to execute a batch file, which is simply a text file containing a list of commands.</li>
<li>A command in the batch file is to call Wget, a program that retrieves content from web servers (like a web browser), and tell it to call the URL of your web script.</li>
</ol>
<p>Note: You might be thinking why we are calling the web script through a publically-accessible URL rather than a local system path, and the reason is to keep this tutorial simple. Calling a local path requires calling the PHP interpreter, which is a bit more complicated. There are also the problem of the current execution path of the script, which may require adjustments to any relative paths you use in your script (such as <a href="http://php.net/include" target="_blank">include()</a> calls). So in this tutorial, we&#8217;ll execute a publically accessible URL, and let the web server take care of the rest.</p>
<p>Note 2: We could just have the Task Scheduler execute Wget directly without the batch file, but I&#8217;ve added it because the batch file can contain more than one command we can execute. However, in this tutorial we will only execute one command.</p>
<p><span style="text-decoration: underline;"><strong>Creating a script to execute periodically</strong></span><br />
We&#8217;ll keep this very simple, and create a script that we can see results . Create the following PHP script.</p>
<pre class="brush: plain; title: ; notranslate">
mail('your-email@domain.com', 'My Subject', 'Hello World!');
</pre>
<p>Replace the email address with your own. Save the file as helloworld.php. This will just send out an email to your email address with &#8220;Hello World&#8221; as the content. Put the file on your web server so that you can access it through a publically available URL. For example: <em>http://test.com/helloworld.php</em></p>
<p><span style="text-decoration: underline;"><strong>Install Wget For Windows</strong></span><br />
<a href="http://gnuwin32.sourceforge.net/packages/wget.htm" target="_blank">Wget</a> is the program that will call the URL (which the web server will execute). <a href="http://sourceforge.net/projects/gnuwin32/files/wget/1.11.4-1/wget-1.11.4-1-setup.exe/download" target="_blank">Download</a> it, and install it on your web server. To make it easier to execute Wget in the batch file without requiring the full path to the Wget executable, add Wget to the path of your system.  For more information on how to do that, visit this page on <a href="http://www.computerhope.com/issues/ch000549.htm" target="_blank">How to set a path in Windows</a>. (Even if you&#8217;re not using Windows 2000/XP, most Windows version applies.) Add the Wget program directory&#8217;s &#8220;bin&#8221; folder, which for most default install is: <em>C:\Program Files\GnuWin32\bin</em></p>
<p><span style="text-decoration: underline;"><strong>Setting up the batch file</strong></span><br />
Create a batch file and name it <em>run.bat</em>. Save it to a location on you web server that is not in a public path. For example (to keep it very simple): <em>C:/scripts/run.bat</em></p>
<p>Open up the batch file and add the following, where <em>test.com</em> is your domain name.</p>
<pre class="brush: plain; title: ; notranslate">wget -q -O nul http://test.com/helloworld.php</pre>
<p>This basically tells Wget to call that URL (to your script), and don&#8217;t output anything nor save to a file.</p>
<p><span style="text-decoration: underline;"><strong>Setting up task scheduler</strong></span><br />
Add a new scheduled task by going to <em>Scheduled Tasks</em> on your web server. It should be located in the Control Panel. Double-click on <em>Add Scheduled Task</em>. Continue until it asks you to browse for a program to execute. Click on &#8220;Browse&#8230;&#8221; and look for and select the <em>run.bat</em> file you created. Continue with the options, enter a name for you task, and select to perform the task <em>Daily</em>, and set the time to 10 minutes from the current time. Continuing on, it will ask for a Windows username and password the task will execute under. After that, you&#8217;ll reach the end, and that&#8217;s it!  You can also opt to view more advance options. With the advanced options, you can even set multiple schedule times under the single task. For example, you want it to run the task once an hour between 8am to 5pm, but only once every four hours thereafter. If you haven&#8217;t changed the advanced options, wait around 10 minutes, and your script should execute. The main screen of the Scheduled Tasks will also display when the last execution time was.</p>
<p>Now, all that&#8217;s left is to turn that script into something useful. The script is like any normal web script and it can do anything you can make it do, such as checking a database for deadlines occurring within one day, and sending out email reminders, etc. Since the URL to the script is public, you might want to add some kind of hard-to-guess preset token to the query string of your URL, and your script checks that it&#8217;s a match before executing it.</p>
]]></content:encoded>
			<wfw:commentRss>http://jimmyli.net/2010/08/task-scheduling-on-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IIS Tutorial Series (Part 3): URL Rewrite on IIS</title>
		<link>http://jimmyli.net/2010/08/url-rewrite-on-iis/</link>
		<comments>http://jimmyli.net/2010/08/url-rewrite-on-iis/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 07:31:49 +0000</pubDate>
		<dc:creator>Jimmy</dc:creator>
				<category><![CDATA[IIS Tutorial Series]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[url rewrite]]></category>

		<guid isPermaLink="false">http://jimmyli.net/?p=129</guid>
		<description><![CDATA[URL Rewriting is a powerful feature for web servers that provides the ability to modify a web page's URL to display a more friendly links for users and relevance for Search Engine Optimization (SEO). For Apache web server users, a mod_rewrite module is readily available, however, for IIS 6.0 users, it's not. (For IIS 7.0, a URL Rewrite Module has been introduced.) In this tutorial, I'll introduce a free URL Rewriter for IIS 6.0 (and later), how to install it, and the recommended method of usage.]]></description>
			<content:encoded><![CDATA[<p>Note: This article is Part 3 of the <a href="/iis-tutorial-series/">IIS Tutorial Series</a>.</p>
<p>URL Rewriting is a powerful functionality that provides you the ability to modify your URL&#8217;s appearance. If you&#8217;re reading this, you probably know what a rewritten URL is so I won&#8217;t go into examples. URL Rewrite has became so common due to its benefits of the relevance of the URL to its page content for Search Engine Optimization (SEO) and for link sharing (e.g. social media), many Content Management Systems (CMS), such as WordPress, and programming frameworks already provide out-of-the-box ability to transform ugly URLs to &#8220;pretty URLs&#8221;. That is, on the front-end. However, the web server cannot understand the pretty URLs to send the results properly back to the web application. That is what a URL Rewrite module is for. It converts transparently the pretty URLs back to the ugly URL so the web server can send the data properly back to the application.</p>
<p>For those who&#8217;ve worked with Apache, almost all types of modules for your needs are readily available, easily to download if necessary, and a plentiful of documentation available. Fortunately, for IIS 7.0 or later users, Microsoft does provide a <a href="http://learn.iis.net/page.aspx/460/using-the-url-rewrite-module/" target="_blank">URL Rewrite Module</a> (which I won&#8217;t go into here). Unfortunately, for users of IIS 6.0, we have to resort to third-party modules to provide URL Rewrite functionality. Although there are a few of them that are easy to find, most of them are not free, or they provide a free limited version, such as only a limited number of URL rewrites per day, or rewrite rules that are active for the whole server, and not for individual websites. In this tutorial, I&#8217;ll introduce a free and powerful URL Rewriter, and step through the installation and basic setup.</p>
<p><span style="text-decoration: underline;"><strong>Download and Installation</strong></span><a href="http://iirf.codeplex.com/" target="_blank"><br />
Iconics ISAPI Rewrite Filter (IIRF)</a> is a free ISAPI Rewrite filter that works on IIS 6.0 or later. It can be set up to be used similar to Apache&#8217;s .htaccess rules so that rules applies only to a specific website, or even a single directory. The rewrite rules are also very similar to, if not exact, Apache&#8217;s rewrite rules. To begin, visit the <a href="http://iirf.codeplex.com/" target="_blank">IIRF website</a> and download the ZIP file (version 2.0, at this time of writing).</p>
<p>Installing is as simple as unzipping the file, and placing the folder in the root of your server&#8217;s hard drive (e.g. C:\IIRF\). That&#8217;s it! IIRF is installed!</p>
<p><span style="text-decoration: underline;"><strong>Website Setup</strong></span><br />
To set up an IIS website to use IIRF, open up your IIS Manager, select your website, right-click and select &#8220;Properties&#8221;. Click on the <em>ISAPI Filters</em> Tab at the top.</p>
<p><a href="http://jimmyli.net/wp/wp-content/uploads/2010/08/filter_properties.png"><img class="aligncenter size-medium wp-image-134" title="Website Filter Properties" src="http://jimmyli.net/wp/wp-content/uploads/2010/08/filter_properties-300x291.png" alt="Website Filter Properties" width="300" height="291" /></a></p>
<p>On the left, click on &#8220;Add&#8230;&#8221; to add a new filter. Use a name that is easy for you to understand. Here, I used &#8220;ISAPI Rewrite&#8221; as the Filter Name. For the Executable, browse to the DLL of your IIRF installation. It should be in the &#8220;bin&#8221; folder (e.g. C:\IIRF\bin\IIRF.dll).</p>
<p><a href="http://jimmyli.net/wp/wp-content/uploads/2010/08/add_filter_properties.png"><img class="aligncenter size-medium wp-image-135" title="Add Filter Properties" src="http://jimmyli.net/wp/wp-content/uploads/2010/08/add_filter_properties-300x291.png" alt="Add Filter Properties" width="300" height="291" /></a></p>
<p>Hit &#8220;OK&#8221; to save your settings, and &#8220;OK&#8221; again to save and exit properties. Just like that, your website should be enabled to use IIRF. You&#8217;ll have to do this for each website on the server that you want to use URL Rewrite for.</p>
<p><span style="text-decoration: underline;"><strong>Adding Rewrite Rules</strong></span><br />
This is very similar to Apache&#8217;s .htaccess rules. The rules for IIRF are so similar, pretty much any rules that I find online for .htaccess I can use for IIRF, and it works fine. To add rules, create a file called <em>IIRF.ini</em> in the directory you want to use the rewrite on. For most of us, that should be the root public directory of the website.</p>
<p>To do a quick check on whether IIRF is set up properly, edit the IIRF.ini file and add the following line:</p>
<pre class="brush: plain; title: ; notranslate">StatusUrl /iirfStatus RemoteOk</pre>
<p>This will load a status page at the /iirfStatus directory of your URL. You&#8217;ll also need to be sure you have a host name or URL mapped to your website to test this. For example, if your website is at <em>test.com</em>, visit <em>http://test.com/iirfStatus</em> to see the status of IIRF. If a status page loads that is similar to the image below, IIRF is working properly for the website. (You&#8217;ll probably want to remove this StatusURL line before production.)</p>
<p><a href="http://jimmyli.net/wp/wp-content/uploads/2010/08/iirf_status_reports.png"><img class="aligncenter size-medium wp-image-136" title="IIRF Status Report" src="http://jimmyli.net/wp/wp-content/uploads/2010/08/iirf_status_reports-300x165.png" alt="IIRF Status Report" width="300" height="165" /></a>That&#8217;s it! URL Rewrite should be enabled for your website. For a list of rules and logging options, there should be a help guide in the IIRF installation folder: /AdminGuide/Help/IirfGuide.chm<br />
An <a href="http://iirf.codeplex.com/documentation" target="_blank">online documentation</a> version is also available. If you need help, the <a href="http://iirf.codeplex.com/Thread/List.aspx" target="_blank">discussion forum</a> is also fairly active and useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://jimmyli.net/2010/08/url-rewrite-on-iis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New: IIS Tutorial Series</title>
		<link>http://jimmyli.net/2010/08/new-iis-tutorial-series/</link>
		<comments>http://jimmyli.net/2010/08/new-iis-tutorial-series/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 08:03:34 +0000</pubDate>
		<dc:creator>Jimmy</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[IIS]]></category>

		<guid isPermaLink="false">http://jimmyli.net/?p=127</guid>
		<description><![CDATA[Despite my lack of updates, I&#8217;ve noticed based on search query logs of visitors arriving on this website, a lot of them are regarding installing PHP 5.3 on IIS. Due to the fact that you can no longer use ISAPI with PHP 5.3, I&#8217;ve had the same frustrating experience as others when I was trying [...]]]></description>
			<content:encoded><![CDATA[<p>Despite my lack of updates, I&#8217;ve noticed based on search query logs of visitors arriving on this website, a lot of them are regarding installing PHP 5.3 on IIS. Due to the fact that you can no longer use ISAPI with PHP 5.3, I&#8217;ve had the same frustrating experience as others when I was trying to upgrade from PHP 5.2 to 5.3. I did a lot of research on it, and resources were few, so I decided to write about it once I&#8217;ve successfully was able to upgrade.</p>
<p>Due to the demand of IIS usage there, and resources are few and scatter, I&#8217;ve decided to start an <a href="http://jimmyli.net/iis-tutorial-series/">IIS Tutorial Series</a>, beginning with <a href="http://jimmyli.net/2010/02/installing-fastcgi-and-php-for-iis-6-0/">Part 1: Installing FastCGI and PHP for IIS 6.0</a>. I hope this is able to help a lot of those who are using IIS, especially with PHP. Over time, I will be adding more tutorials. My experience as a web developer mainly began with using Apache, but eventually having to use IIS at my workplace, I&#8217;ve found that a lot of the convenience features with Apache were not available (or easily available) in IIS, so I want to be able to create more tutorials on being able to use such features on IIS.</p>
]]></content:encoded>
			<wfw:commentRss>http://jimmyli.net/2010/08/new-iis-tutorial-series/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IIS Tutorial Series (Part 2): Talking to SQL Server with PHP on IIS</title>
		<link>http://jimmyli.net/2010/08/talking-to-sql-server-with-php-on-iis/</link>
		<comments>http://jimmyli.net/2010/08/talking-to-sql-server-with-php-on-iis/#comments</comments>
		<pubDate>Sun, 08 Aug 2010 09:09:01 +0000</pubDate>
		<dc:creator>Jimmy</dc:creator>
				<category><![CDATA[IIS Tutorial Series]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[mssql]]></category>

		<guid isPermaLink="false">http://jimmyli.net/?p=114</guid>
		<description><![CDATA[Microsoft now has an official SQL Server Driver to use with PHP on IIS. This is a huge and step forward for PHP/SQL Server developers since beginning with PHP 5.3, the usually packaged MSSQL extension has been deprecated.]]></description>
			<content:encoded><![CDATA[<p>Note: This article is Part 2 of the <a href="/iis-tutorial-series/">IIS Tutorial Series</a>.</p>
<p>Starting with a little history, before PHP 5.3, the options of getting PHP to talk to a Microsoft SQL Database Server was either using a generic database connector, such as ODBC, or PHP&#8217;s included MSSQL connector extension. The MSSQL extension was nice compared to ODBC as you didn&#8217;t have to set up a separate object (the ODBC connection object) to talk to the SQL Server. The MSSQL extension is very similar to PHP&#8217;s popular MySQL Extension as there are functions solely for that database type. Disappointingly, beginning from PHP 5.3, that MSSQL has been deprecated and no longer included with the PHP package, as it was stated to be unstable and unofficially supported (as well as maintenance stopped a long time ago). Initially, people started re-compiling PHP 5.3 on their own with the old MSSQL to get the functionality back, but like for the most of us, re-compiling PHP is not something we would want to step into.</p>
<p>Fortunately, Microsoft stepped up their game and finally started to support more open-source projects such as PHP, and created an official driver to talk to their SQL Server with PHP. In this tutorial, I will go over how to install the SQL Server Driver, and connect to an SQL Server with PHP. This tutorial is applicable for SQL Server 2000 or later, using PHP versions 5.2.4 or later.</p>
<p>Note: You&#8217;ll need to have PHP installed on the IIS Server. If not, read <a href="http://jimmyli.net/2010/02/installing-fastcgi-and-php-for-iis-6-0/">Part 1</a> of the tutorial series on how to do so.</p>
<p>First, visit Microsoft&#8217;s page to download the <a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=80e44913-24b4-4113-8807-caae6cf2ca05" target="_blank">SQL Server Driver for PHP</a>. As of this writing, the driver is currently version 2.0. If your SQL Server is installed remotely (not on the same server as the IIS server), you&#8217;ll need to download the Microsoft SQL Server 2008 Native Client at Microsoft&#8217;s <a href="http://www.microsoft.com/downloads/details.aspx?familyid=B33D2C78-1059-4CE2-B80D-2343C099BCB4" target="_blank">SQL Server 2008 Feature Pack</a> site. If the SQL Server is on the same server, then you&#8217;ll already have the necessary Native Client library installed, and you can skip the following step. There are a lot of packages on that page. To quickly locate the right one, scroll down until you find a section &#8220;Microsoft SQL Server 2008 Native Client&#8221;, or you can use your web browser&#8217;s page search functionality to jump to it immediately. Download MSI package appropriate for your server.</p>
<p>If you had to download the SQL Server Native Client, run that executable to install it first. Then, execute the downloaded file for the SQL Server Driver. This will just do a self-extract to a folder. Save the extracted folder anywhere you want. In the folder will be a set of DLLs. Choose the DLL that is appropriate for the PHP package you are using. For more information on which DLL to use, look at the readme that&#8217;s also included in the folder. Copy that DLL and paste it into the &#8220;ext&#8221; directory of your PHP folder (e.g. C:\php\ext\). This adds the extension for PHP to use, and contains the SQL Server API functions you use in your code. This extension talks to the Native Client, which is the interface to the SQL Server.</p>
<p>Next, open up the php.ini in your PHP installation folder, and enable that extension. There should be a section with many lines of:<br />
<em>extension=xxxxxxxxx.dll</em></p>
<p>Add a new line that is specific for the DLL you are using. e.g. <em>extension=php_sqlsrv_53_nts_vc9.dll</em></p>
<p>Restart the IIS Server for all the settings to take effect. To check that the extensions is working, create a PHP script on your website with <a href="http://php.net/phpinfo" target="_blank">phpinfo</a> and the section for the &#8220;sqlsrv&#8221; extension should be in there somewhere.</p>
<p>That should be it for the installation. In the folder for the SQL Server driver should also be a file named <em>SQLSRV20_Help.chm</em>, which is a help file that includes the API documentation of the driver. There is an <a href="http://msdn.microsoft.com/en-us/library/ee229551%28v=SQL.10%29.aspx" target="_blank">online version</a> of the documentation as well.</p>
<p>For example, to connect to a SQL Server database with PHP, you can use something similar to the following code:</p>
<pre class="brush: plain; title: ; notranslate">$connectionInfo = array('UID'=&gt;'Username', 'PWD'=&gt;'password', 'Database'=&gt;'Northwind');
$conn = sqlsrv_connect('MY-DBSERVER', $connectionInfo);
if ($conn === false) die( print_r( sqlsrv_errors() ) );
</pre>
<p>Note: This code applies to authenticating as a SQL Server user, and not a Windows Authentication user. I have not gotten successful connection as a Windows user. If anyone knows how, please leave a comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://jimmyli.net/2010/08/talking-to-sql-server-with-php-on-iis/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<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>26</slash:comments>
		</item>
		<item>
		<title>Finally a working SQL Server Driver for PHP 5.3</title>
		<link>http://jimmyli.net/2009/09/finally-a-working-sql-server-driver-for-php-5-3/</link>
		<comments>http://jimmyli.net/2009/09/finally-a-working-sql-server-driver-for-php-5-3/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 21:17:25 +0000</pubDate>
		<dc:creator>Jimmy</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[ms sql]]></category>
		<category><![CDATA[mssql]]></category>
		<category><![CDATA[PHP 5.3]]></category>

		<guid isPermaLink="false">http://jimmyli.net/?p=52</guid>
		<description><![CDATA[Update: I’ve started an IIS Tutorial Series on Talking to SQL Server with PHP on IIS which contains more details of this installation. It&#8217;s been a while since I&#8217;ve touched on the issue of having PHP 5.3 talk to a MS SQL Server on IIS (without using ODBC or other connection methods).  Last time I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p><em><strong>Update:</strong> I’ve started an IIS Tutorial Series on <a href="../../2010/08/talking-to-sql-server-with-php-on-iis/">Talking to SQL Server with PHP on IIS</a> which contains more details of this installation.</em></p>
<p>It&#8217;s been a while since I&#8217;ve touched on the issue of having PHP 5.3 talk to a MS SQL Server on IIS (without using ODBC or other connection methods).  <a href="/2009/08/no-sql-server-library-for-php-5-3-just-yet/">Last time</a> I&#8217;ve mentioned that Microsoft has an official SQL Server Driver (v1.0) for PHP to talk to a SQL Server only to find that it doesn&#8217;t work for PHP pre-v5.3, which, we didn&#8217;t really need anyway because PHP already came with a MS SQL Library driver (which was removed from 5.3) that <a href="/2009/03/php-unable-to-connect-to-mssql/">somewhat works</a>.</p>
<p>However, after starting to play around with PHP 5.3 with SQL Server again I&#8217;ve noticed that Microsoft finally release <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ccdf728b-1ea0-48a8-a84a-5052214caad9&amp;displaylang=en" target="_blank">v1.1 of the SQL Server Driver</a>, one that was stated to work with PHP 5.3 on IIS. Lo and behold, I was finally able to get it to work.  Even better, the package also came with an offline documentation on installing the driver and the whole API Reference.  Very nice.  For those who are interested, here is the documentation online, the lo-bandwidth version (no MS Frames):<br />
<a href="http://msdn.microsoft.com/en-us/library/cc296172%28SQL.90,loband%29.aspx" target="_blank">SQL Server Driver v1.1 for PHP</a></p>
<p>Note that if your SQL Server is on another server from the PHP server, you&#8217;ll also need to install the SQL Native Client data access library on the PHP server.  (If it is on the same server, the installation of SQL Server already installs this package.)  It is highly recommended to use the latest version that works with SQL Server 2008.  It took me a while to find it (the 2005 version link is rampantly posted everyhere), but you can find it officially here:<br />
<a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=C6C3E9EF-BA29-4A43-8D69-A2BED18FE73C&amp;displaylang=en" target="_blank">Microsoft SQL Server 2008 Feature Pack, August 2008</a></p>
<p>Near the bottom of the page you&#8217;ll find &#8220;Microsoft SQL Server 2008 Native Client&#8221;.  Get the one that&#8217;s appropriate for your machine.  Despite it saying 2008, it should be backwards compatible with earlier versions of SQL Server.  I&#8217;ve tried it as far as SQL Server 2000 (on IIS 6.0) and was able to connect and query successfully (I haven&#8217;t tested for limitations and such, if any.)</p>
<p>And there you have it.  The official method to talk to a MS SQL Server on IIS with PHP 5.3, straight from Microsoft themselves.</p>
<p><span style="text-decoration: underline;">Updated: October 09, 2009</span><br />
The version of the SQL Driver 1.1 that was released in August was a preview release version.  Microsoft officially released the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ccdf728b-1ea0-48a8-a84a-5052214caad9&amp;displaylang=en" target="_blank">final version</a> of SQL Server Driver 1.1 on October 6th.</p>
]]></content:encoded>
			<wfw:commentRss>http://jimmyli.net/2009/09/finally-a-working-sql-server-driver-for-php-5-3/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>No SQL Server Library for PHP 5.3 Just Yet</title>
		<link>http://jimmyli.net/2009/08/no-sql-server-library-for-php-5-3-just-yet/</link>
		<comments>http://jimmyli.net/2009/08/no-sql-server-library-for-php-5-3-just-yet/#comments</comments>
		<pubDate>Sat, 08 Aug 2009 04:06:53 +0000</pubDate>
		<dc:creator>Jimmy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[mssql]]></category>
		<category><![CDATA[ODBC]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://jimmyli.net/?p=45</guid>
		<description><![CDATA[Update: This article is considered outdated. I’ve started an IIS Tutorial Series on Talking to SQL Server with PHP on IIS. Last time I posted about PHP deciding to remove the MS SQL Server Connection driver and library from the PHP 5.3 package, and mentioned that Microsoft now has its own version of the MS [...]]]></description>
			<content:encoded><![CDATA[<p><em><strong>Update:</strong> This article is considered outdated. I’ve started an IIS Tutorial Series on <a href="../../2010/08/talking-to-sql-server-with-php-on-iis/">Talking to SQL Server with PHP on IIS</a>.</em></p>
<p><a href="http://jimmyli.net/2009/07/installing-php-53-on-microsoft-iis/" target="_blank">Last time</a> I posted about PHP deciding to remove the MS SQL Server Connection driver and library from the PHP 5.3 package, and mentioned that Microsoft now has its <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=61BF87E0-D031-466B-B09A-6597C21A2E2A&amp;displaylang=en" target="_blank">own version</a> of the MS SQL Server driver for PHP.  I&#8217;ve decided to start playing around with it and after a few hours of no luck getting it to work with PHP 5.3 (it doesn&#8217;t show up in phpinfo), I&#8217;ve decided to do a search on it.  What I&#8217;ve found on the MSDN message boards was that the MS SQL  Server driver PHP, version 1.0 (the current and version), does not have support for PHP 5.3. (<a href="http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/9285793e-3ddb-49be-b138-d8cdccadb635" target="_blank">reference</a>)  Not until version 1.1 comes out, at least. This is rather stupid considering now there is no direct MS SQL Server driver for PHP 5.3.  The only way I know of is to use an <a href="http://www.php.net/manual/en/ref.uodbc.php" target="_blank">ODBC</a> connection.</p>
]]></content:encoded>
			<wfw:commentRss>http://jimmyli.net/2009/08/no-sql-server-library-for-php-5-3-just-yet/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

