Connecting to SQL Server using windows authentication

A

Anonymous

Guest
Hey, I'm brand new to PHP, and to get my feet wet, I just wanted to make a form that writes a record to a database (sql server 2014).

I read that if you don't specify a username or password, PHP will use windows authentication by default. But it will use the credentials of the identity of the app pool that is running the php application.

So I made an app pool, and set it to run under the identity of an active directory user (this user is used to connect to the same DB for other processes).

But when I run the form, I get a connection error. It looks like the PHP engine is trying to connect to the database as an anonymous user rather than with the application pool identity.

Has anyone out there set this up?

[SQLSTATE] => 28000 [1] => 18456
Code:
 => 18456 [2] => [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. [message] => [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. ) [1] => Array ( [0] => 28000
 
 
        $serverName = "trans";
        $connectionInfo = array("Database"=>"transdb");        
        $conn = sqlsrv_connect($serverName,$connectionInfo);
 
Back
Top