I am trying to connect to the MSSQL server through php, but my pdo connection gives me hard time and errors that I really don't understand. The code I pasted below worked perfectly, a week ago, and suddenly it just stopped, without changing anything. I can still connect to the server and run requests directly from the command line, but I don't have the same luck in php. Does anyone see what I am missing? I have spent too much time on this already, and it seems that I am running in circles.
Firstly, this is the error I get from my PDOException
SQLSTATE[] (null) (severity 0)
Part of my Mssql ()
private function __construct() {
try{
$this->_pdo = new PDO('dblib:host=' . Config::get('prod/host') . ':'. Config::get('prod/port') .';dbname=' . Config::get('prod/db'),Config::get('prod/username'), Config::get('prod/password'));
}catch(PDOException $e){
die($e->getMessage());
}
}
public static function getInstance(){
if (!isset(self::$instance)) {
self::$instance = new Mssql();
}
return self::$instance;
}
As i call it
function getClients(){
$conn = Mssql::getInstance();
And my init.php
prod' => array(
'host' => 'xxxxxxx',
'port' => '1433',
'username' => 'xxxxxxx',
'password' => 'xxxxxx',
'db' => 'xxxxxxx'
),
//.....
source
share