note 74346 modified in ref.mssql by danbrown
| From: | danbrown@php.net | Date: | Mon, 18 May 2009 02:08:29 +0000 |
| Subject: | note 74346 modified in ref.mssql by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155623@lists.php.net to get a copy of this message | ||
If your having problems with your script at random times refusing to connect to the database. Try
editing php.ini and uncommenting this line.
mssql.max_procs = -1
This solved the problem for me after 3 days of pulling my hair out wondering why it kept refusing to
connect!
==
[Because this may not always work,] I created a loop to create a few connections and noticed it was
always the first connection that failed. So I wrote this to keep trying to connect until it
eventually does.
<?php
while(!$connection){
@$connection =
mssql_connect($cfg['server'],$cfg['username'],$cfg['password']);
}
$db = mssql_select_db($cfg['database'],$connection) or die("Error selecting the
database");
?>
--was--
If your having problems with your script at random times refusing to connect to the database. Try
editing php.ini and uncommenting this line.
mssql.max_procs = -1
This solved the problem for me after 3 days of pulling my hair out wondering why it kept refusing to
connect!
http://php.net/manual/en/ref.mssql.php