Hello:
I am trying to connect to a MS SQL server who has NT Authentication enabled. I'm connecting from a Win32 desktop with PHP 4.4.1 with the following PHP.INI variable enabled: mssql.secure_connection = On
My problem is that I'm failing to connect with the following error:
Warning: mssql_connect(): message: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. (severity 14) in c:\tools\apache13\apache\htdocs\krtest.php on line 4
The event log of the system running the database server I'm trying to connect to says:
An anonymous session connected from SRCHSQL1A has attempted to open an LSA policy handle on this machine. The attempt was rejected with STATUS_ACCESS_DENIED to prevent leaking security sensitive information to the anonymous caller.
The application that made this attempt needs to be fixed. Please contact the application vendor. As a temporary workaround, this security measure can be disabled by setting the \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\TurnOffAnonymousBlock DWORD value to 1.
This message will be logged at most once a day.
QUESTION: How do I configure my PHP script OR PHP.INI to authenticate as the user I have logged into the desktop as? I can use classic MSSQL tools like Query Analyzer and automatically connect to the DB and query against many tables with no problems. It appears that my PHP applications running on my own desktop appear to be connecting as "anonymous"; therefore failing the connection.
Thanks for your response in advance. My simple code block is shown below:
Lester (i.e. logging in as LJackso)
Code:
<?PHP
print "attemptping to connect to SRCHSQL1A...<br>";
$resource = mssql_connect("SRCHSQL1A");
print $resource;
print "<hr>attemptping to select database KnowledgeRespository...<br>";
$database = mssql_select_db('KnowledgeRespository',$resource);
print $database;
?>