I'm having a problem running my PHP project on our IIS with SQL Server 2019. My version of PHP is 7.0.26 and I have already imported SQLSRV DLLS.
When I try to login with my system, the following error is popping up:
Connection could not be established. Array ( [0] => Array ( [0] => 28000 [SQLSTATE] => 28000 [1] => 18456 [code] => 18456 [2] => [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user 'sa'. [message] => [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user 'sa'. ) [1] => Array ( [0] => 28000 [SQLSTATE] => 28000 [1] => 18456 [code] => 18456 [2] => [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user 'sa'. [message] => [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user 'sa'. ) )
This is some part of my connection string.
$myCon = array("Database"=>$myDB, "UID"=>$myUser, "PWD"=>$myPass);
$db = sqlsrv_connect( $myServer, $myCon);
Also, I tried to trace the error, like adding the wrong credentials to see if there is some changes on the error message but it is still the same.
We tried some configurations, like setting up the server authentication into "SQL Server and Windows Authentication Mode", firewall is disabled, and also setting up the Native client configuration.
IIS configuration was made setting MIME Type, default document, connection string, Application Pool, and all the path config was set.
I also installed only ODBC Driver 13, 2015 Redistributable, .NET 4 framework.
Can anyone help me? Thank you.
LOGIN(and neededUSERs) for your web app, with the minimal amount of permissions needed and use that too. Then, if you fail to connect check the SQL Server's logs. Thesaaccount should never be used by an application to connect. - Larnu