I am trying to connect using PHP to SQL Server on another machine. I found two ways to do 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 am unable to contact using Windows Authentication.
So far I have tried the following: used a work pass, added Trusted_Connection = yes; or Integrated Security = SSPI ;, I also tried combining this with fastcgi.impersonate = 1 or 0.
When I use my user directly and pass, I get an login-dependent error, and when I try to authenticate Windows with sspi, I get the following error: Login failed for user "NT AUTHORITY \ ANONYMOUS LOGON".
I searched a lot for the problem, but could not find a solution. However, some people have said that php is not using a Network Service account, and that this could be a problem.
Does anyone know how I can fix this or perhaps give me an edge?
Thanks in advance.
source share