0

I've been having problems connecting to a Microsoft SQL Server 2008 database through Windows Authentication using the following PHP code:

<?php

$serverName = "sql";
$options = array("Database" => "db_name");
$conn = sqlsrv_connect($serverName, $options);

if($conn == false) {
    die(print_r(sqlsrv_errors()));
}

?>

I get the following error message: [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'DOMAIN\TOMHANKS$'.1

When I connect to MS SQL Server through the Management Studio with Windows Authentication, I log-in as DOMAIN\tom.hanks.

From what I understand, the identity that is used to connect to the server will always be the identity of the process in which PHP is running. How do I change this identity such that it is the same as my Windows log-in? Thanks.

4

0 回答 0