RE: What happens when the database is down?

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

 



Are you saying you don't see "Cannot connect to database"?, even after
doing a view source to make sure its not hiding?

Also, when you say "hang" does the browser act as if it is waiting for
more information, or does it stop and simply not render the rest of the
page?

The page will simply stop rendering because PHP hits the die() and does
what it is told. Any HTML/PHP after that die() will NOT be processed.

Two things control whether your going to see any error message. The
display_errors directive in the php.ini file, and the error_reporting
level.

Put this in the script with the mysql_* calls, preferably at the top.

	error_reporting(E_ALL);
	ini_set("display_errors",1);

If you still can't see "Cannot connect to database", then you got me. I
have never experienced a problem with the mysql_* functions actually
hanging. According to what your saying the page should not even start
rendering if the mysql_* calls are truly locking, unless your using
buffering and flush(). Worst case if the functions were locking, you
would see a PHP script execution timeout error, if they are being
displayed.


Ben Lake

-----Original Message-----
From: Hanxue Lee [mailto:hlee20@student.monash.edu] 
Sent: Sunday, July 20, 2003 6:21 AM
To: php-db@lists.php.net
Cc: ie40@yahoogroups.com
Subject: Re:  What happens when the database is down?


Thank you for your answers. Perhaps I have not explained myself well 
enough. 

Firstly, I split the logic/data access code into a PHP class and the 
each HTML page is represented by a PHP file.

The PHP file will call functions such as addStaff() which will write 
all the Staff details to the database. In other words, the mysql_connect
() and other database code is in the Staff.class.php

No, I do not use the '@' sign

I use mysql_connect(...) or die("Cannot connect to database")

Therefore, if there are any problems, by right the line should be 
displayed, but it isn't.

Our client is using the latest versions of Apache, PHP and MySQL. MySQL 
4.0.12 is stable and so far I have not encountered any problems. By the 
way, the problem is those mysql_ functions just 'hang', no response. 
Not invalid response. This lead me to suspect it is some timeout 
problem. MySQL 4.0.12 is production version (latest production version 
is 4.0.13, Alpha 4.1.0). 

AFAIK, Apache 2 is around for ages, and it is easier to maintain 
compared to Apache 1.3.x (IMHO). BTW, I have not experienced any 
problem running PHP with Apache 2.

What I want to know is:
1. How come the mysql_ calls do not timeout?
2. I do not get some error displayed on the HTML page?
3. How do I set PHP and MySQL call timeouts?


Thank you very much.


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


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

  Powered by Linux