Tech Tips on Computers, Internet, Blogging, Web Development, Social Media, Android and more

Full width home advertisement

Post Page Advertisement [Top]

Drupal Error: The website encountered an unexpected error - MySQL server has gone away


The following is an error I encountered on a live Drupal site. There may be different scenarios when this error may be encountered. In my particular case, this PDOException error occurred after enabling or after installing modules on Drupal 7.53
.

The Error:
PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2006 MySQL server has gone away'

AH01071: Got error 'PHP message: PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2006 MySQL server has gone away' in /var/www/vhosts/thedomainname.com/httpdocs/includes/database/database.inc:2227\nStack trace:\n#0 /var/www/vhosts/thedomainname.com/httpdocs/includes/database/database.inc(2227): PDOStatement->execute(Array)\n#1 /var/www/vhosts/thedomainname.com/httpdocs/includes/database/database.inc(697): DatabaseStatementBase->execute(Array, Array)\n#2 /var/www/vhosts/thedomainname.com/httpdocs/includes/database/database.inc(2406): DatabaseConnection->query('SELECT expire, ...', Array, Array)\n#3 /var/www/vhosts/thedomainname.com/httpdocs/includes/lock.inc(167): db_query('SELECT expire, ...', Array)\n#4 /var/www/vhosts/thedomainname.com/httpdocs/includes/lock.inc(146): lock_may_be_available('schema:runtime:...')\n#5 /var/www/vhosts/thedomainname.com/httpdocs/includes/bootstrap.inc(433): lock_acquire('schema:runtime:...')\n#6 /var/www/vhosts/thedomainname...\n', referer: http://thedomainname.com/user/login

Symptoms:
  • The Drupal site does not work / open as administrator also. Website throws message " The website encountered an unexpected error ".
  • But the site opens for anonymous user when viewed on another browser.
Solution:

The first thing I would suggest that you do, is look at your Server's log, and see what you can find for clues of the error there. In my experience, the "Unexpected error" seems to be a general error message that Drupal throws, while there may likely be a more detailed message in the log files.

If you are on development environment:
  • Go to xampp\mysql\bin
  • Open my.ini
  • Change "max_allowed_packet" from "1m" to "16m"
  • Save my.ini
  • Now restart MySql through the XAMPP control panel.

Similar issues discussed on: https://www.drupal.org/node/186384#comment-3062828


In my case, I added: max_allowed_packet = 64M to my.ini and it solved the problem.


1 comment:

Bottom Ad [Post Page]