As the title suggests I'm trying to connect to an SQL database (which has been working for years) and has suddenly stopped working. I'm using PHP and I've created a little test PHP file which literally just tries to connect.
All I get when connecting is a false object, and sqlsrv_errors contains nothing. PHP code is:
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
sqlsrv_configure("WarningsReturnAsErrors", 0);
$server = "*redacted*";
$connectionInfo = array( "database"=>"*redacted*", "UID"=>"*redacted*","PWD"=>"*redacted*");
$conn = sqlsrv_connect($server, $connectionInfo);
if( $conn === false ) {
die( print_r( sqlsrv_errors(),true));
} else {
print("Worked");
}
?>
I don't believe anyone has changed anything but I've since updated the PHP/SQL Driver versions to try and get it working.
I've checked the SQL login by going in directly etc and the server is running on the default port.
All I get back is a blank response (assuming because the sqlsrv_errors are empty)
Environment Details: Website/php is running on IIS on Windows Server 2019 PHP v8.2.10, SQL Driver v5.11 (php_sqlsrv_82_nts_x64)
The SQL server is remote (but on the same subnet/lan) I've tried via IP and name to make sure it's not dns.
To add a few more things I've tried:
Well.. this is not what I expected it to be.
Turns out we had removed "Domain Users" from the "Users" group within computer management on the server running IIS. IIS is using pass thru authentication so I would guess this is why - even though the actual scripts were using SQL authentication.
Re-adding the Domain Users group has fixed it.