I am trying to connect using PHP to an SQL Server on another machine. I have found two ways of doing this. Either with odbc_connect or sqlsrvr connect.
$connection = odbc_connect("Driver={SQL Server Native Client 10.0};Server=$serverName;Database=$db;", 'user', 'pass');
or
$conn = sqlsrv_connect($serverName, array('UID' => '', 'PWD' => ''));
The connection works if I try to connect to an SQL account. Unfortunately I cannot manage to connect using the Windows Authentication.
So far I have tried the following : used a working pass, added Trusted_Connection=yes; or Integrated Security=SSPI; . I have also tried combining this with fastcgi.impersonate = 1 or 0.
When I use directly my user and pass I get a login denied error and when I try the windows authentication with sspi I receive the following error:Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.
I've googled the problem a lot but I could not find a solution. Some people however were talking about php not using the Network Service account and that that might be the problem.
Does anyone know how I could fix this or maybe give me a lead?
Thank you in advance.