This assumes you’ve already installed IIS for Windows 2003. In this example I’m using x86.
1. First download and install the Microsoft 2008 C++ Runtime. Forx86 click here, and forx64 click here.
2. Download, and install the Microsoft FastCGI addon for IIS make sure it’s allowed in the IIS extensions (IIS Manager > Web Service Extensions), and restart the WWW publishing service.
3. Download and install PHP for Windows. I chose 5.2 because at the time of this writing MSSQL extensions weren’t compatible with 5.3 yet (of course I found out the hard way after installing 5.3, and ended up downgrading). You can download the VC9 version (assuming you are using IIS and not Apache). It’s up to you if you want to download the thread safe or the non thread safe. The difference can be foundhere. For this example I choose non thread safe.
4. Restart the WWW publishing service.
5. Download Microsoft SQL Server Driver for PHP. Put the php_sqlsrv.dll (or php_sqlsrv_ts.dll if you installed the thread safe version of PHP) in the PHP extensions directory (default location will be C:\Program Files\PHP\ext).
6. Now edit the php.ini file in the PHP directory (default location will be C:\Program Files\PHP), and put the following where all the extensions are located at (near the bottom).
Non thread safe: extension=php_sqlsrv.dll
Thread safe: extension=php_sqlsrv_ts.dll.
7. Download and install the Microsoft SQL Server Native Client since my SQL server is remote (normally this would be already loaded if SQL is on the same machine as this server)
7. Restart the WWW publishing service.
8. Now lets verify that PHP and the MSSQL driver are loaded. Create a info.php file in your wwwroot and put the below code in file and save it. Now visit http://localhost/info.php, and you should see PHP information, including if the MSSQL extension loaded. That’s it. Now if you need to find out how to connect to MSSQL through PHP in code, reference the help file that came with the SQL server driver download.
<?php
phpinfo()
?>