I have a new windows 2019 server running IIS with PHP 7.4.x and is working properly and the sql server and odbc drivers were installed.
Now when I try to connect to a remote mssql instance , I get the following error.
$serverName = "//servername\dbinstance";
$connectionInfo = array( "Database"=>"DBname", "UID"=>"username", "PWD"=>"password");
$conn = sqlsrv_connect($serverName, $connectionInfo);
if( $conn ) {
echo "Connection established.<br />";
}else{
echo "Connection could not be established.<br />";
die( print_r( sqlsrv_errors(), true));
}
I installed SSMS on the php server and I can connect to the remote database server without any problems!
What did I do wrong with php?
In linux, it may fail because of SELinux turned on but this is Windows 2019 LOL
thoughts?
thanks
dbinstanceor something else that starts withn,r,tor some other character that is transformed into something else when combined with a single backslash? Can you connect if you escape the backslash ("//servername\\dbinstance")? - rickdenhaan