Skip to content
Advertisement

PHP MSSQL Server connection issue

I have a database of MSSQL server 2005. I can connect to the server via MSSLQL client software (MSSQL Management Studio).
The issue is I cant connect to the server from PHP script using the same credentials. And also all mssql configurations are valid in php and apache.

This is the error I receive:

JavaScript

PHP:

JavaScript

All credentials are valid and working.

Advertisement

Answer

Is your web server running on Windows? If so, what version of ntwdblib.dll do you have? See this help page for a much more in-depth explanation.

This error is a pain because it’s not very descriptive. I remember the first time I had to wrestle with it (the problem has been around for at least a few years)… but having the correct DLL makes all the difference in the world.

If you’re trying to connect from a linux box, then you might consider switching from mod_php to php-cgi (or vice versa) as I’ve read success stories from that. But then, I don’t remember ever having this problem when connecting a linux web server to a MSSQL box.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement