Today I installed the necessary components to get PHP 5.4 and SQL Server 2008 R2 to communicate using the excellent instructions in the link provided by Robert Johnson in this post:
http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/c2035bfb-02a0-4364-a355-ce3fe412b8b7. When I attempt to connect to the MS SQL Server database it gives this error message:
[SQLSTATE] => 28000
[code] => 18456
[message] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'knot-PC\knot'
A further look in the MS SQL Server database error log reveals that the severity is 14 and the state is 58. I'm not sure whether this error is because something didn't get installed correctly or because there's something wrong with the parameters supplied for the login. Here is the PHP being used for that:
<?php $serverName = 'knot-PC'; $connectionInfo = array( 'Database' => 'Calculator3', 'UID' => 'knot-PC\knot', 'PWD' => ''); $dbc = sqlsrv_connect($serverName, $connectionInfo); $errors = sqlsrv_errors(); echo '<pre>' . print_r($errors, 1) . '</pre>'; ?>
The login being used for UID and PWD exactly matches the login credentials when I use Toad for SQL Server or SQL Server Management Studio. Any ideas on what to try next to establish the database connection?
Thanks, Knot