I have searched through many posts trying to find an answer but get nowhere. I am trying to establish a connection to and Sql Server DB through my PHP web application using WAMP.
What I have tried:
- I downloaded the sql drivers for PHP 7 and 7.1 and tried them with the corresponding PHP versions
- I made sure to restart all services after updating the php.ini file.
- I haveinstalled the SQLSRV40.EXE and updated the php.ini with:
- extension=php_pdo_sqlsrv_7_ts_x64.dll
- extension=php_pdo_sqlsrv_7_nts_x64.dll
I did not though that even though these are added in the php.ini they were not in the php> php extentions list - not sure why
This is my code below allow with the error
<?php
$serverName="DESKTOP-0KNJ0KP";
$connectionInfo=array("Database"=>"SPMS_db",);
$conn=sqlsrv_connect($serverName,$connectionInfo);
if ($conn) {
echo "Connected.<br />";
} else {
echo "Connection failed.<br />";
die( print_r( sqlsrv_errors(), true));
}
?>
I have added context fro PHPinfo()



