I'm trying to connect to an MSSQL database with PHP and encounter a very frustrating error while trying to connect. It loads for a minute, before printing out the following message:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[08001]:
[Microsoft][SQL Server Native Client 11.0]Named Pipes Provider: Could not open a connection to SQL Server [53].
Here's my connection string:
DB::config("sqlsrv:Server={$dbHost} ; Database={$dbName}", $dbUser, $dbPass);
And in my DB class:
public static function config($dsn, $user, $pass)
{
self::$_pdo = @new PDO($dsn, $user, $pass);
...// intentionally left out
I'm very baffled. I have the following module configured in my php.ini file: extension=php_pdo_sqlsrv_54_ts.dll. Although I think I installed it right and I don't receive any error message about the driver not working, this bit of PHP prints nothing:
if (function_exists( 'sqlsrv_connect' ))
echo "hey";
and as you can see from my error message above SQL Server Native Client 11 appears to be working. I'm on a Windows platform. I tried disabling the firewall to no avail. I don't have much information about the SQL server or I would share it here.
This is my first time posting on Stack, so I apologize if I'm leaving out a key piece of information or I'm not following proper etiquette in some way, but any help is definitely appreciated.
Also, I should add that I've already done too much Googling, and haven't had any success.