Hi David,
I'm having to schedule MySQL restarts on my server every few days or so to improve performance and free up memory. What I'm after is, when MySQL is down, a 'Web site is currently down for maintenance' style message or web page to be displayed. I guess, some quick test to see if a MySQL database is available and if not, redirect to an 'information' web page. Otherwise site visitors are greeted by a rather barren web site!
Any ideas please?
Cheers.
Keeop
Hi Keeop,
Sure - as includes/common.php is included on every page; you could add the following code at the end of that script (so that config.php has already been included):
$link = @mysql_connect($config_databaseServer,$config_databaseUsername,$config_databasePassword);
if (!$link)
{
header("Location: /offline.php");
exit();
}
This won't cause any delay because the connection will be used by the script the first time a call to the database library is made...
Cheers,
David.