How does the connection between PHP and MSSQL work?

A native php mssql driver nl. sqlsrv_connect ipv mssql_connect is used

You will find more information on the following link:

Example of a connection:

/* Specify the server and connection string attributes. */
$serverName = "(";

/* Get UID and PWD from application-specific files. */
$connectionInfo = array( "UID"=>”test”,

/* Connect using SQL Server Authentication. */
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false )
echo "Unable to connect.</br>";
die( print_r( sqlsrv_errors(), true));

sqlsrv_close( $conn);

Additional information:
Working with Microsoft SQL Server driver (php_sqlsrv.dll) for PHP on Windows

mssql vs. sqlsrv: What’s the Difference? (Part 1)

SQLSRV Driver API Reference
Posted : - Mon, Jul 23, 2012 4:34 PM. This article has been viewed 4979 times.
Online URL:

Powered by PHPKB (Knowledge Base Software)