Re: Is this a mysql_connect() bug?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 29 Jan 2005 tom soyer wrote:

> I tried mysql_connect() function, and it won't reture FALSE if
> connection failed. Instead, the script times out after 30 seconds and
> displays an Fatal error message "Maximum execution time of 30 seconds
> exceeded". 

I think the issue here is if the server does not respond it hits the 
execution time limit before the function returns.

I use code like this:

	$olderr = error_reporting(0);
	set_error_handler('ignoreerrhandler');
	$dbHandle = mysql_connect($dbHost, $dbUser, $pw);
	restore_error_handler();
	error_reporting($olderr);

	.....

	function ignoreerrhandler($errno, $errstr, $errfile, $errline) {
		return;
	}

You can also control the connection timeout with the 
mysql.connect_timeout setting in php.ini.

--
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux