A site I help administer was showing a uncaught exception 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).

The server returns 200/OK. The .htaccess files contains the following lines.

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

Is there a way to make Drupal return the correct HTTP status?

  • I get a 500 when the DB is off.
    – mikeytown2
    Apr 1, 2015 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. Apr 2, 2015 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. Apr 2, 2015 at 20:15


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.