PHP on Vista with IIS7

I upgraded my work machine, back in October.  My old standby IBM Thinkpad T30, after years of loyal service, was starting to fall apart.  Random pieces were coming loose from the case and the keyboard was no longer delivering "Five 9's reliability".  Sometimes the keys worked, sometimes not.  Also the disk drive was giving me block errors, and the fan was generating some new sounds.  It was time to move on... (snif)  The Thinkpad was really a nice machine for me. 

I got a new HP (Compaq) nc8430 - this is a sweet, svelte new wide-screen design.  Much faster than the thinkpad, and with a huge screen, huge hard drive.  It came with Windows XP pre-installed, but before I ever logged in, I installed a clean build of Windows Vista on it.  Nice graphics!  

I have been using the nc8430 as my main machine for some time now, it's working out nicely for me.  I turned off the disk indexing, it was slowing everything down.  Also I got some updated drivers from HP and all the various built-in devices (bluetooth, wireless nic, etc) now are working well.  I hadn't migrated everything over to this new machine, I'm sort of doing it in phases.  Previously, I installed Visual Studio and SQL Express on it.   This week I moved PHP onto it.  PHP works very nicely with the new IIS7 that is part of Vista. 

Why would I install PHP?  you ask...  For interop testing and demonstrations, of course!   I like to demonstrate practical interop between Microsoft technologies, particularly .NET, and other technologies, as much as I can.  So PHP + .NET is a key interop combination.  But also PHP + IIS7, and PHP + SQL2005, and so on. 

The Thinkpad had PHP 4.3.1 on it, but for the new machine I am getting current - so I put on PHP 5.2.0 instead.  I have SQL Server 2005 Express Edition (free download!)  On the thinkpad, I had no trouble connecting PHP to SQL Server 2000 - this new combination was not much different. Simpler, I'd say, due to the better design of IIS7.

  1. download and install PHP, as per BillS' instructions.
  2. copy the php.ini file to c:\windows
  3. Edit the php.ini file to enable php_mssql.dll  (uncomment the line)
  4. install php_mssql.dll into c:\windows\system32
  5. get the new ntwdblib.dll (version 2000.80.194) from your SQL Server and install it in c:\windows\system32. (don't use the ntwdblib.dll from the php 5.2.0 zip)
  6. Use the SQL Configuration Manager to enable remote connections to SQL Server Express. Enable named pipes, TCP/IP, and VIA

Ba-da-boom, you're done.  Go to town.

What about the Interop?

For now, PHP apps can connect to SQL and perform any queries at all, including taking advantage of the new XML stuff in SQL 2005. And PHP can generate XML as output, which can then be consumed by any .NET app, including, for example, a WCF app that consumes RSS or POX.   I'll be looking into examples of all of these in the near future.