- Do not use the web platform installer. If you already have, uninstall PHP and FastCGI using the Control Panel
- Download the Non Thread Safe ZIP version from http://windows.php.net/download/, unpack it in C:\PHP5
- Download FastCGI from http://www.iis.net/download/FastCGI (already included in Windows 7)
- Add the .php file extension mapping using the IIS manager or
C:\WINDOWS\system32\inetsrv>cscript fcgiconfig.js -add -section:"PHP" -extension:php -path:"C:\PHP5\php-cgi.exe"
- Download the VC9 non-thread safe FreeTDS dll from http://download.moodle.org/download.php … B_NOTS.zip or (preferred - this one has parameterized queries) the v2 php_sqlsrv_53_nts_vc9.dll - search for the download link on http://blogs.msdn.com/sqlphp - it’s in beta now.
- In c:\php5\php.ini:
error_log = c:\devel\php-errors.log
fastcgi.impersonate = 1
extension=ext\php_sqlsrv_53_nts_vc9.dll
- Set the application protection level to Low (IIS Process)
- in a file.php
<?php
ini_set('error_reporting',E_ALL);
ini_set('display_errors','On');
ini_set('display_startup_errors','On');
//phpinfo();
$serverName = "(local)\sqlexpress";
$connectionOptions = array("Database"=>"aa", "UID"=>"zz", "PWD"=>"yy");
$conn = sqlsrv_connect($serverName, $connectionOptions); $s=sqlsrv_errors();
if(!$conn) echo ('cannot connect: ' .$s[0][2]);
else { echo 'Successful connection';
sqlsrv_close($conn); }