0

Just wanted to preface this with saying I've read through all the other stack overflow questions I can find on here, but nothing's helped my issue, so I'm posting a question.

I've got an SQL server running off my local system, and I'm trying to connect to it using PHP, but I get no feedback from my code whether it successfully connected or not, just showing a blank page. My trial code is

 $serverName = "desktopname"; //servername\instancename (instance is default MSSQLSERVER)
 $connectionInfo = array( "Database"=>"WebTest");
 $conn = sqlsrv_connect($serverName,$connectionInfo);

 if($conn) {
     echo "Connection established.";
 }
 else{
     echo "Connection failed";
     die( print_r( sqlsrv_errors(), true));
 }

I've enabled the extensions in php.ini, downloaded the MS odbc drivers, and successfully connected using sqlcmd -Smachinename but for some reason, nothing I do on the PHP side gives me any sort of error or success message. How can I fix this?

Kraegan
  • 1
  • 1
  • "Blank page" almost always means that you need to enable proper error reporting first of all, so check the mentioned duplicate. – CBroe Sep 14 '21 at 14:33

0 Answers0