I have windows 10 64 bit and installed xampp version 7.3 and I am trying to connect with SQL server using my below code but it always gives me that error:
"Uncaught Error: Call to undefined function sqlsrv_connect()".
I have downloaded ODBC versions 11,13,17 and I downloaded dll drivers and located them in my "xampp/php/ext". also I have changed the extension in my php.ini file and tried every single extension with different versions but nothing works!
<?php
echo phpinfo();
$serverName = "ServerNAme"; //serverName\instanceName
// Since UID and PWD are not specified in the $connectionInfo array,
// The connection will be attempted using Windows Authentication.
$connectionInfo = array( "Database"=>"DB[![enter image description here][1]][1]");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
echo "Connection established.<br />";
sqlsrv_close($conn);
}else{
echo "Connection could not be established.<br />";
die( print_r( sqlsrv_errors(), true));
}
?>