A site I help administer was showing a MySQL error page,

Additional uncaught exception thrown while handling exception.
PDOException: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) in _registry_check_code() (line 3154 of /home/jcorneli/beta/includes/bootstrap.inc).

... but returning a 200/OK status. The .htaccess contains

# Make Drupal handle any 404 errors.
ErrorDocument 404 /index.php

Is there a way to make Drupal return a proper error when MySQL is down?

  • I get a 500 when the DB is off. – mikeytown2 Apr 1 '15 at 18:35
  • I'm not sure if off and erroring states are going to produce the same result. But I'm not sure how to replicably put the database in an erroring state. – Joe Corneli Apr 2 '15 at 8:15
  • 1
    You can get it to show the maintenance page when DB errors occur, instead of the ugly that it shows there. Then you can theme that maintenance page like your 404, except it can't have menus and such of course b/c bootstrap is ended. – burnsjeremy Apr 2 '15 at 20:15

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.