Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Wed Dec 03, 2014 7:45 am 
Offline
Newbie

Joined: Fri Aug 08, 2014 5:52 am
Posts: 4
I'd like to customize the generic "error establishing a database connection" message when a system goes down. Tried to google to find out where this file exists within (presumably PHP?) but of course, all one finds are people trying to solve the actual problem.

So, does anyone know where this file lives? Is it part of PHP, MySQL, Nginx?

Thanks in advance... :-)


Top
   
PostPosted: Wed Dec 03, 2014 7:49 am 
Offline
Senior Member

Joined: Wed Oct 20, 2010 12:35 pm
Posts: 111
Location: United Kingdom
cre8tives wrote:
I'd like to customize the generic "error establishing a database connection" message when a system goes down. Tried to google to find out where this file exists within (presumably PHP?) but of course, all one finds are people trying to solve the actual problem.

So, does anyone know where this file lives? Is it part of PHP, MySQL, Nginx?

Thanks in advance... :-)


Find out what HTTP error return code PHP returns with that response and customise your HTML template for that return code. You should be able to do that within your PHP script depending on which PHP framework you use.


Top
   
PostPosted: Wed Dec 03, 2014 9:11 am 
Offline
Senior Member

Joined: Mon Jan 02, 2012 12:45 pm
Posts: 365
cre8tives wrote:
I'd like to customize the generic "error establishing a database connection" message when a system goes down.
[snip]
So, does anyone know where this file lives? Is it part of PHP, MySQL, Nginx?

That message is usually crated by the application having trouble connecting to the database. It is not a page, and is not created by any specific component of your stack (eg, PHP, MySQL or Nginx).

Depending on which application you are using (custom/rolled your own, Wordpress, Drupal, etc, etc) the error message will be different and will be created in a different file with different code.

Customizing this error message is trivial. Once you find the code file that handles the database connection you'll see either the generic message or the call to the function that handles all database errors. If you see the generic message you can customize it right there (after you make a backup of the file, of course). If you find a function that handles all database errors you will need to code find the file that contains that code and go from there.

Once you've found the code that does the error handling you can probably find some help by searching the internet for something like "mysql handling connection errors" (without the quotes)


Top
   
PostPosted: Wed Dec 03, 2014 10:24 am 
Offline
Newbie

Joined: Fri Aug 08, 2014 5:52 am
Posts: 4
Thanks James!

I wouldn't have immediately guessed that this message would be coming from WordPress, but indeed it is, in a specific functions file. That means I can customize it with our tech support number!

Now how to figure out why the site is going down in the first place, hahaha.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group