The Silencer
The Silencer

Reputation: 787

mssql_connect stops working after some time

I have a website that occacionally fails to connect to the database. It starts by having problems on just a few page requests here and there, but after a while it just stops and can't connect at all. This is the error message I get:

Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: localhost in C:\wwwroot\x.se\root\classes\adodb5\drivers\adodb-mssql.inc.php on line 520

If I restart Apache, it works fine again for a while - so it doesn't seem to be a problem with the dbserver. I tried to update the ntwdblib.dll but it didn't help.

This is the environment:

On top of this, due to various reasons, I can't just take this live server down for a couple of hours and reinstall stuff (well I guess I have to if all else fails). I will probably try to update PHP and/or Apache, but I'm looking for less invasive solutions to start with.

phpinfo() output:

Upgraded ADODB from V5.06 (16 Oct 2008) to V5.15 (19 Jan 2012) didn't help either.

.. and upgrading the PHP stack from v5.2.9-2 (26 Feb 2009) to 5.2.17 (2011-Mar-22 13:29:30) didn't work.

Upvotes: 0

Views: 2061

Answers (2)

The Silencer
The Silencer

Reputation: 787

I simply turned off the mssql persistant connections in php.ini and now it seems to work.

Upvotes: 1

KillerX
KillerX

Reputation: 1466

Have you tried using persistent connections? Might help if you are connecting often: http://php.net/manual/en/function.mssql-pconnect.php

Upvotes: 0

Related Questions