<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Brent Phillips - Interoperability Blog : PHP</title><link>http://blogs.msdn.com/brentphillips/archive/tags/PHP/default.aspx</link><description>Tags: PHP</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>PHP SDK for Windows Azure</title><link>http://blogs.msdn.com/brentphillips/archive/2009/05/14/php-sdk-for-windows-azure.aspx</link><pubDate>Fri, 15 May 2009 01:08:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9617197</guid><dc:creator>brentphillips</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/brentphillips/comments/9617197.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brentphillips/commentrss.aspx?PostID=9617197</wfw:commentRss><description>&lt;P&gt;Check it out - &lt;A href="http://blogs.msdn.com/interoperability/archive/2009/05/13/announcing-php-sdk-for-windows-azure-and-much-more.aspx"&gt;http://blogs.msdn.com/interoperability/archive/2009/05/13/announcing-php-sdk-for-windows-azure-and-much-more.aspx&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9617197" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brentphillips/archive/tags/Interoperability/default.aspx">Interoperability</category><category domain="http://blogs.msdn.com/brentphillips/archive/tags/PHP/default.aspx">PHP</category><category domain="http://blogs.msdn.com/brentphillips/archive/tags/Azure/default.aspx">Azure</category></item><item><title>PHP + SQL Server 2008</title><link>http://blogs.msdn.com/brentphillips/archive/2009/05/03/php-sql-server-2008.aspx</link><pubDate>Mon, 04 May 2009 03:24:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9585058</guid><dc:creator>brentphillips</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/brentphillips/comments/9585058.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brentphillips/commentrss.aspx?PostID=9585058</wfw:commentRss><description>&lt;P&gt;I just pulled down the &lt;A title="SQL Server driver for PHP" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=61BF87E0-D031-466B-B09A-6597C21A2E2A&amp;amp;displaylang=en" target=_blank mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyId=61BF87E0-D031-466B-B09A-6597C21A2E2A&amp;amp;displaylang=en"&gt;cumulative update for the SQL Server Driver for PHP (April 09 edition)&lt;/A&gt;. For those of you who read my walk through for &lt;A title="PHP + SQL Server 2005" href="http://blogs.msdn.com/brentphillips/archive/2008/07/31/trying-out-sql-server-2005-drivers-for-php.aspx" target=_blank mce_href="http://blogs.msdn.com/brentphillips/archive/2008/07/31/trying-out-sql-server-2005-drivers-for-php.aspx"&gt;PHP connectivity to SQL Server 2005&lt;/A&gt;, the driver&amp;nbsp;also supports SQL Server 2008. All steps are the same as my original walk through&amp;nbsp;with the addition of&amp;nbsp;a new dll file and an additional extension configuration in the php.ini file. More information on PHP and SQL Server can be found here at the &lt;A title="SQL-PHP Blog" href="http://blogs.msdn.com/sqlphp/archive/2009/04/29/april-2009-cumulative-update-now-available.aspx" target=_blank mce_href="http://blogs.msdn.com/sqlphp/archive/2009/04/29/april-2009-cumulative-update-now-available.aspx"&gt;sqlphp blog&lt;/A&gt;.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9585058" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brentphillips/archive/tags/Interoperability/default.aspx">Interoperability</category><category domain="http://blogs.msdn.com/brentphillips/archive/tags/PHP/default.aspx">PHP</category><category domain="http://blogs.msdn.com/brentphillips/archive/tags/SQL+Server/default.aspx">SQL Server</category></item><item><title>Trying out SQL Server 2005 drivers for PHP</title><link>http://blogs.msdn.com/brentphillips/archive/2008/07/31/trying-out-sql-server-2005-drivers-for-php.aspx</link><pubDate>Fri, 01 Aug 2008 04:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8796297</guid><dc:creator>brentphillips</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/brentphillips/comments/8796297.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brentphillips/commentrss.aspx?PostID=8796297</wfw:commentRss><description>&lt;P&gt;Per my last post, I thought I would check out the new &lt;A class="" title="PHP Drivers for SQL Server 2005" href="http://blogs.msdn.com/sqlphp/archive/2008/07/28/microsoft-sql-server-2005-driver-for-php-v1-0-has-released.aspx" target=_blank mce_href="http://blogs.msdn.com/sqlphp/archive/2008/07/28/microsoft-sql-server-2005-driver-for-php-v1-0-has-released.aspx"&gt;PHP drivers for SQL Server 2005&lt;/A&gt;. From an interoperability perspective, this is really interesting for me. I 'cut my teeth' writing web applications early in my career which started on ASP (and Vsual Interdev)&amp;nbsp;then moved to .NET. Over the years,&amp;nbsp;in my perpetual study of&amp;nbsp;web technologies, I came to use the WAMP stack for most web publishing (Windows + Apache + MySQL + PHP) because I had developed a high comfort level with the PHP script. Interestingly the&amp;nbsp;'WISP' stack never crossed my mind until recently&amp;nbsp;(Windows +&amp;nbsp;IIS +&amp;nbsp;SQL Server + PHP), so I wanted to see how easy it could be set up, and how well it ran. The configuration was pretty straightforward although there were a couple of things that I had to research - setting up fastCGI for example.&lt;BR&gt;&lt;BR&gt;I've outlined my steps here...To note, I put all of this together on my laptop (specs noted below).&lt;/P&gt;
&lt;TABLE class="" style="WIDTH: 500px" border=1 border-color="#dddddd"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class=""&gt;Hardware&lt;/TD&gt;
&lt;TD class=""&gt;HP Pavilion Entertainment PC&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class=""&gt;Processor&lt;/TD&gt;
&lt;TD class=""&gt;Intel Core 2 Duo 2.0 GHz&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class=""&gt;RAM&lt;/TD&gt;
&lt;TD class=""&gt;4GB&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class=""&gt;OS&lt;/TD&gt;
&lt;TD class=""&gt;Windows Vista Ultimate 32 bit&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;OL&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;I&amp;nbsp;had previously installed Microsoft SQL Server 2005 Standard edition&amp;nbsp;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;I then downloaded/installed &lt;A class="" title="PHP non-thread safe" href="http://www.php.net/downloads.php" target=_blank mce_href="http://www.php.net/downloads.php"&gt;PHP non-thread-safe&lt;/A&gt; zip package (unpacked it and dropped it into 'c:\php')&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;I grabbed the&amp;nbsp;&lt;A class="" title="PHP drivers for SQL Server 2005" href="http://go.microsoft.com/fwlink/?LinkId=123470" target=_blank mce_href="http://go.microsoft.com/fwlink/?LinkId=123470"&gt;PHP drivers for SQL Server 2005&lt;/A&gt; and dropped them into the&amp;nbsp;following folder 'c:\php\ext'&amp;nbsp;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;Following &lt;A class="" title="FastCGI for IIS7" href="http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis7/" target=_blank mce_href="http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis7/"&gt;this article&lt;/A&gt;, I&amp;nbsp;setup FastCGI for IIS7, key steps here:&lt;/DIV&gt;&lt;/LI&gt;
&lt;UL&gt;
&lt;DIV mce_keep="true"&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;make sure CGI is enabled for IIS (this covers FastCGI in IIS 7.0).&lt;/DIV&gt;&lt;/LI&gt;&lt;/DIV&gt;
&lt;UL&gt;
&lt;LI&gt;In Windows Features, go to Internet Information Services -&amp;gt; World Wide Web services -&amp;gt; App Dev Features -&amp;gt; CGI&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;IMG title="CGI setup" style="WIDTH: 500px; HEIGHT: 300px" height=300 alt="CGI setup" src="http://www.brentphillips.com/images/forInterop/phpsql/cgi.png" width=500 align=middle border=0 mce_src="http://www.brentphillips.com/images/forInterop/phpsql/cgi.png"&gt;&lt;BR&gt;&lt;/LI&gt;
&lt;LI&gt;Update the php.ini file with the following lines:&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;set fastcgi.impersonate = 1&lt;/LI&gt;
&lt;LI&gt;set cgi.fix_pathinfo = 1&lt;/LI&gt;
&lt;LI&gt;set cgi.force_redirect = 0&lt;/LI&gt;
&lt;LI&gt;set open_basedir = your path to the webroot (mine is "c:\inetpub\wwwroot")&lt;/LI&gt;
&lt;LI&gt;for the SQL driver, add the following&amp;nbsp;under the 'Windows Extensions' section: extension=php_sqlsrv.dll&lt;BR&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;LI&gt;In the management console, I had to add a FastCGI handler as follows:&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;Under Services and Applications click on IIS and look for your server and server's 'HOME' menu&lt;/LI&gt;
&lt;LI&gt;in the area for IIS, double click on Handler Mapping. &lt;/LI&gt;
&lt;LI&gt;In the&amp;nbsp;'Actions' menu, click on 'Add Module Mapping' which pops open a wizard&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;extension is '*.php' (no quotes)&lt;/LI&gt;
&lt;LI&gt;In the module dropdown, click 'FastCGImodule'&lt;/LI&gt;
&lt;LI&gt;the path should be the path to your php-cgi.exe file (mine was 'c:\php\php-cgi.exe')&lt;/LI&gt;
&lt;LI&gt;then name it "PHP via FastCGI' or something similar&lt;BR&gt;&lt;BR&gt;&lt;IMG title=FastCGI style="WIDTH: 500px; HEIGHT: 300px" height=300 alt=FastCGI src="http://www.brentphillips.com/images/forInterop/phpsql/manager.png" width=500 align=middle mce_src="http://www.brentphillips.com/images/forInterop/phpsql/manager.png"&gt;&lt;BR&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;
&lt;LI&gt;At this point, I dropped a default.php into the root directory and added the following code:&lt;BR&gt;&amp;lt;?php&lt;BR&gt;phpinfo();&lt;BR&gt;?&amp;gt;&lt;BR&gt;it worked...If you need to add a default or index page to handle php, this can also be done through the management console by using the 'Default Document' feature.&lt;BR&gt;&lt;/LI&gt;
&lt;LI&gt;From here, I added some modified &lt;A class="" title="Sample Code" href="http://msdn.microsoft.com/en-us/library/cc296196.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/cc296196.aspx"&gt;sample&lt;/A&gt; code to test connectivity to the database. In the same file as above, I added the following couple of lines of code just before the phpinfo() line - I'm using Windows Authentication on the database:&amp;nbsp;&lt;BR&gt;&lt;BR&gt;$serverName = "(local)";&lt;BR&gt;$connectionInfo = array( "Database"=&amp;gt;"Master");&lt;BR&gt;$conn = sqlsrv_connect( $serverName, $connectionInfo);&lt;BR&gt;&lt;BR&gt;if( $conn )&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo "&amp;lt;div align='center'&amp;gt;Connection established to SQL Server on server " . $serverName . ".\n\n";&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;else&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo "Connection could not be established.\n";&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; die( print_r( sqlsrv_errors(), true));&lt;BR&gt;}&lt;BR&gt;&lt;BR&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;U&gt;This step failed unfortunately&lt;/U&gt;, and after reviewing the error information, I noted that the IUSR account was unable to access SQL Server.&lt;BR&gt;I ran through the new login setup and tried again.&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;IMG title=IUSR style="WIDTH: 500px; HEIGHT: 300px" height=300 alt=IUSR src="http://www.brentphillips.com/images/forInterop/phpsql/ntuser.png" width=500 mce_src="http://www.brentphillips.com/images/forInterop/phpsql/ntuser.png"&gt;&lt;BR&gt;&lt;BR&gt;&lt;/LI&gt;
&lt;LI&gt;I gave it another try and 'voila,'&amp;nbsp;it worked - nothing fancy, but a fairly painless process. My 'success' screen...&lt;BR&gt;&lt;BR&gt;&lt;IMG title=Connection style="WIDTH: 500px; HEIGHT: 300px" height=300 alt=Connection src="http://www.brentphillips.com/images/forInterop/phpsql/connection.png" width=500 align=middle mce_src="http://www.brentphillips.com/images/forInterop/phpsql/connection.png"&gt;&lt;BR&gt;&lt;BR&gt;&lt;/LI&gt;
&lt;LI&gt;FIN!&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8796297" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brentphillips/archive/tags/Interoperability/default.aspx">Interoperability</category><category domain="http://blogs.msdn.com/brentphillips/archive/tags/PHP/default.aspx">PHP</category></item></channel></rss>