Your PHP Web applications can be deployed on the Windows platform with SQL Server by using of the SQL Server Driver for PHP. The driver is a Microsoft-supported extension of PHP 5 that provides a procedural interface for reading and writing data from within PHP scripts in all SQL Server 2005 and SQL Server 2008 editions (including SQL Server Express edition).
The SQL Server Driver for PHP API provides a comprehensive data access solution from PHP, and includes support for many features including Windows Authentication, transactions, parameter binding, streaming, metadata access, connection pooling, and error handling.
The following PHP code will create a sample connection to SQL Server TestDB using Windows Authentication through SQL Server Driver:
In order to execute this you need to have SQL Server Driver for PHP in place.
$serverName = “.\INSTANCE”;
$connectionInfo = array( “Database”=>”TestDB”);
$connection = sqlsrv_connect( $serverName, $connectionInfo);
if( $connection === false )
echo “Unable to connect”;
die( FormatErrors( sqlsrv_errors(), true));