I have done so much research trying to get my PHP code hosted in IIS to connect to my MSSQL database. I just can't understand this problem. Has anyone come across this before?
<?php $serverName = 'AEGIS-PC\SQLEXPRESS'; $connectionInfo=array('Database'=>'tttb_db'); $con = sqlsrv_connect($serverName, $connectionInfo); if($con){ echo 'Connection established<br />'; } else { echo 'Connection failed<br />'; die(print_r(sqlsrv_errors(), TRUE)); } ?>
Update, we have a new error:
Connection error Array ([0] => Array ([0] => 28000 [SQLSTATE] => 28000 [1] => 18456 [code] => 18456 [2] => [Microsoft] [ODBC 11 driver for SQL Server ] [SQL Server] Login failed for user "NT AUTHORITY \ IUSR. [Message] => [Microsoft] [ODBC 11 driver for SQL Server] [SQL Server] Login failed for user" NT AUTHORITY \ IUSR.) [1 ] => Array ([0] => 42000 [SQLSTATE] => 42000 [1] => 4060 [code] => 4060 [2] => [Microsoft] [ODBC driver 11 for SQL Server] [SQL Server] Not unable to open database "tttb_db" is requested at login. Login error. [message] => [Microsoft] [ODBC driver 11 for SQL Server] [SQL Server] Cannot open database "tttb_db" requested at login . Error input.) [2] => Array ([0] => 28000 [SQLSTATE] => 28000 [1] => 18456 [code] => 18456 [2] => [Microsoft] [ODBC driver 11 for SQL Server] [SQL Server] Login [message] => [Microsoft] [ODBC 11 driver for SQL Server] [SQL Server] Login failed for user "NT AUTHORITY \ IUSR".) [3] => Array ([0] => 42000 [SQLSTATE] => 42000 [1] => 4060 [code] => 4060 [2] => [Microsoft] [ODBC 11 driver for SQL Server] [SQL Server] Cannot open the database "tttb_db" requested at login into the system. Login failed. [message] => [Microsoft] [ODBC 11 driver for SQL Server] [SQL Server] Cannot open the database "tttb_db" requested at login. Login failed. )))
Our SQL server uses Windows Authentication, and our server name is AEGIS-PC\SQLEXPRESS when the username and password blocks are grayed out. I canβt think of the reason why our login will fail. What are we doing wrong?
source share