MS IIS PHP connection to MS SQL Server help

Windows 2012 R2 64 bit
MS IIS 8.5, PHP 7.1.1 on one server
MS SQL 2012 on a different server
Can’t connect to DB

  1. downloaded SQLSRV4.0, extracted and placed in php/ext dir
  2. added to php.ini
    [PHP_SQLSRV_71_NTS]
    extension=php_sqlsrv_71_nts.dll
    [PHP_PDO_SQLSRV_7_TS_X64]
    extension=php_pdo_sqlsrv_7_ts_x64.dll
  3. I can see info in the phpinfo()
  4. I can run php code
  5. can NOT connect to MS SQL Server (no errors showing up, just blank page)

$serverName = “Servername”; //serverName\instanceName
$connectionInfo = array( “Database”=>“dbname”); //, “UID”=>“userName”, “PWD”=>“password” // I tried with user/pass also

$conn = sqlsrv_connect( $serverName, $connectionInfo);

if( $conn ) {
echo “Connection established.
”;
}else{
echo “Connection could not be established.
”;
die( print_r( sqlsrv_errors(), true));
}

Tried including username and password
Please help me connect to DB,
thank you.

Sponsor our Newsletter | Privacy Policy | Terms of Service