Thursday, March 22, 2012

Can not connect to mssql with php

Using mssql_connect($server, $user, $password) results in different ways the 'php server'

connects to the sql server.

On a workstation with WinXPProf, php uses the $user and $password to login and uses the

sql server authentication. Running the same script from a W2K3 server results in an error

because in this case the 'php server' tries to connect to the sql server using windows

authentication. (I have checked this difference with wireshark)

The problem has nothing to do with the sql server settings (mixed mode) / firewalls /

php.ini- file settings or versions of ntwdblib.dll because these are the same for both

connections. The problem looks more fundamental, probably due to settings in windows or

the iis version running on the server and the workstation.

Does anyone has a clue how to force php to use sql server authentication.

Pitching Theo pitcher_32@.hotmail.com

It should be as simple as setting mssql.secure_connection = Off in your php.ini. (Informative thread) If that still doesn't do it, check the output of the phpinfo() function to make sure php is using the php.ini file that you believe it is (I've had that bite me in the butt once or twice before).
|||

Like I said both php boxes read the php.ini file and yes mssql.secure_connection = Off.

This is also confirmed by phpinfo().

It seems to be a problem for more than 4 years now checking all sort of discussions

on the net. A lot of people mention this problem but no one seems to know why one

php box tries to login to the sql server with "serverName\IUSR_serverName"

(anonymous IIS account) and the other php box with an empty string continuing with

an sql server authentication providing $user and $password from the mssql_connect()

function. Like I said it doesn't look a php problem/setting but a windows specific thing.

Anyone has a clue ? please let me know

No comments:

Post a Comment