Finally a working SQL Server Driver for PHP 5.3
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’s been a while since I’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’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’t work for PHP pre-v5.3, which, we didn’t really need anyway because PHP already came with a MS SQL Library driver (which was removed from 5.3) that somewhat works.
However, after starting to play around with PHP 5.3 with SQL Server again I’ve noticed that Microsoft finally release v1.1 of the SQL Server Driver, 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):
SQL Server Driver v1.1 for PHP
Note that if your SQL Server is on another server from the PHP server, you’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:
Microsoft SQL Server 2008 Feature Pack, August 2008
Near the bottom of the page you’ll find “Microsoft SQL Server 2008 Native Client”. Get the one that’s appropriate for your machine. Despite it saying 2008, it should be backwards compatible with earlier versions of SQL Server. I’ve tried it as far as SQL Server 2000 (on IIS 6.0) and was able to connect and query successfully (I haven’t tested for limitations and such, if any.)
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.
Updated: October 09, 2009
The version of the SQL Driver 1.1 that was released in August was a preview release version. Microsoft officially released the final version of SQL Server Driver 1.1 on October 6th.