Quantcast
Channel: Microsoft Drivers for PHP for SQL Server forum
Viewing all articles
Browse latest Browse all 391

Connection to SQL Server 2008 - Login failed for user

$
0
0

Hi

I have setup a PHP webpage and am trying to connect to an SQL Server 2008 on another machine.

I have installed 'Microsoft Drivers for PHP for SQL Server' on my local machine which also has WAMP installed with PHP version 5.3.5.

I am getting the following error:

array ( [0] => Array ( [0] => 28000 [SQLSTATE] => 28000 [1] => 18456 [code] => 18456 [2] => [Microsoft][SQL Server Native Client 10.0][SQL Server]Login failed for user 'DOMAIN\Ryans'. [message] => [Microsoft][SQL Server Native Client 10.0][SQL Server]Login failed for user 'DOMAIN\Ryans'. ) [1] => Array ( [0] => 28000 [SQLSTATE] => 28000 [1] => 18456 [code] => 18456 [2] => [Microsoft][SQL Server Native Client 10.0][SQL Server]Login failed for user 'DOMAIN\Ryans'. [message] => [Microsoft][SQL Server Native Client 10.0][SQL Server]Login failed for user 'DOMAIN\Ryans'. ) )'

I have setup the user under security - logins on the server.

The code i am using to connect to the server is -

$serverName = "crm\MSSQLSERVER,1433";


$connectionInfo = array("UID" => $uid, "PWD" => $pwd, "Database"=> $servername);
$conn = sqlsrv_connect( $serverName, $connectionInfo);

if( $conn )
{
     echo "Connection established.\n";
}
else
{
     echo "Connection could not be established.\n";
     die( print_r( sqlsrv_errors(), true));
}


Any help would be much appreciated.

Regards Ryan


Viewing all articles
Browse latest Browse all 391

Trending Articles