RE: What happens when the database is down?

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

 



>C'mon, think about it.

Right on, Miles.

Hanxue,

One other thing to consider is if you're using the @ in front of your mysql
function calls in PHP (e.g. @mysql_connect()). Especially if you're using
the @ without and additional error checking with things like:

if (!$dbconnect) {
	die (sprintf ("Error [%d]: %s",
	mysql_errno (), mysql_error ()));
}

Since you didn't post any code, I'm not sure if you are using @ or not. But
if you are, the @ will suppress MySQL's error reporting and it will look
like your HTML is just "hanging".

Rich

-----Original Message-----
From: Miles Thompson [mailto:milesthompson@ns.sympatico.ca]
Sent: Saturday, July 19, 2003 10:35 AM
To: php-db@lists.php.net
Subject: Re:  What happens when the database is down?



C'mon, think about it.

Connect to the database at the top of your page - if you can't connect
either error out and die, or branch to alternate output.

As far as lack of error reporting is concerned, check and see what level of
error reporting is set on the server; the manual has a helpful section on
this as well as how to set up and configure .htacess if your ISP has all
error reporting turned off.

If you are running locally, you can adjust the level of error reporting.

There are lots of examples in the PHP manual.

Couple of things: I know PHP and Apache 2 are not a recommended combination
on LInux, you may be better off with 1.3.x. Aren't you also running a beta
or rc version of MySQL - stable is still 3.x, isn't it? You may have two
alternate sources of breakage there.

Cheers - Miles Thompson


At 12:00 AM 7/20/2003 +1000, Hanxue Lee wrote:
>Hi,
>
>I am using PHP 4.3.1, Apache 2.0.46 and MySQL 4.0.12 on Windows 2000
>Processional Edition.
>
>All the code are working fine, with only one exception. When I shut
>down the database, the PHP script will continue running normally until
>it reaches the part where information is retrieved from the database.
>Then, the HTML output just hangs there. No error, nothing.
>
>How can I detect this type of error? Any way I can set some timeout
>limit, etc?
>
>Thank you in advance.
>
>
>Yours truly,
>Hanxue
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


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


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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux