Re: [PHP-DB] What happens when the database is down?

2003-07-20 Thread Hanxue Lee
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-DB] What happens when the database is down?

2003-07-19 Thread Hanxue Lee
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



Re: [PHP-DB] What happens when the database is down?

2003-07-19 Thread Miles Thompson
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


RE: [PHP-DB] What happens when the database is down?

2003-07-19 Thread Rich Hutchins
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:[EMAIL PROTECTED]
Sent: Saturday, July 19, 2003 10:35 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] 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