I have a PHP server running under IIS on serverIIS1
, and a MS SQL database on serverDB4
. I created some PHP code that runs on the serverIIS1
server:
$serverName = "serverDB4\serverDB4";
$connectionInfo = array( "Database"=>"DATABASE_NAME", "UID"=>"DOMAIN.ORG\\databaseadm", "PWD"=>"passwordishere");
$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 verified all this info is correct (the login is a Windows account with proper access, so it's via Windows authentication), but I'm getting this error:
Login failed for user 'DOMAIN.ORG\databaseadm'. [message] => [Microsoft][SQL Server Native Client 10.0][SQL Server]Login failed for user 'DOMAIN.ORG\databaseadm'. )
Why is the login failing? I know the info is right, as I can connect manually remotely via SQL Server Management Studio with those details.
Is it because I'm using Windows authentication? If that does not allow plaintext auth, how can I sqlsrv_connect with a Windows password?