I have been trying to connect to mssql which is on-premises. I keep getting the below err message
Array ( [0] => Array ( [0] => 28000 [SQLSTATE] => 28000 [1] => 18456 [code] => 18456 [2] => [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Login failed for user ‘IIIINfsadiq’. [message] => [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Login failed for user ‘IIIINfsadiq’. ) [1] => Array ( [0] => 28000 [SQLSTATE] => 28000 [1] => 18456 [code] => 18456 [2] => [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Login failed for user ‘IIIINfsadiq’. [message] => [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Login failed for user ‘IIIINfsadiq’. ) )
I have installed the necessary drivers based on my PHP version. Though I use IIIINfsadiq which is my username (Windows) to log in without a password.
I created a connection script just to see if it will connect to mssql. See script below.
<?php
$serverName = "171.11.111.111";
$database = "ISS_CFW";
$uid = "IIIINfsadiq";
$pass = "";
$connection = [
"Database" => $database,
"Uid" => $uid,
"PWD" => $pass
];
$conn = sqlsrv_connect($serverName,$connection);
if(!$conn)
die(print_r(sqlsrv_errors(),true));
else
echo'connection established';
?>
Any solution will be appreciated.
Farouk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.