I've found myself in a Job where I have to work with a windows server (2012) - I've never had problems with establishing DB connection, but now I dont seem to find any right solution.
I'll show you my connecting php code:
error_reporting(-1); ini_set('display_errors', 1); $DB = array ('dbname'=>"test" , 'user'=> '***' , 'passwort'=> '***', 'host'=>'somelocalnetwork ip 192.**'); $connect = "mysql:dbname=".$DB['dbname']."; host=".$DB['host']; try { $dbh = new PDO($connect,$DB['user'], $DB['passwort']); echo "Connection established.
"; $dbh = null; } catch (PDOException $e) { echo $e -> getMessage(); }
This is the result, that i get in my browser:
SQLSTATE[HY000] [2002] Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte.
translated into english :
No connection could be made because the target machine actively refused it .
NOTE: I downloaded mssql drivers and sqlsrv drivers and extracted them to the /ext/ direcoty , included them in the php ini file. But when checking the php_info() i dont see any mssql nor sqlsrv parts. I don't know if thats relevant
The Windows Server is set as WebServer and as normal Microsoft SQL Server