1

This question already has an answer here:

I made a site locally and when I uploaded it to the hosting server, it worked fine except when I went to edit some content type. It showed this error:

The website encountered an unexpected error. Please try again later.

It was showing nothing except the above error. To get more error output, I added a few lines to my index.php file (these lines were added right after the first line):

error_reporting(E_ALL); ini_set('display_errors', TRUE); ini_set('display_startup_errors', TRUE);

The error output was now showing this error:

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2006 MySQL server has gone away' in /home/a2682242/public_html/includes/database/database.inc:2171 Stack trace: #0 /home/a2682242/public_html/includes/database/database.inc(2171): PDOStatement->execute(Array) #1 /home/a2682242/public_html/includes/database/database.inc(683): DatabaseStatementBase->execute(Array, Array) #2 /home/a2682242/public_html/includes/database/database.inc(2350): DatabaseConnection->query('SELECT expire, ...', Array, Array) #3 /home/a2682242/public_html/includes/lock.inc(167): db_query('SELECT expire, ...', Array) #4 /home/a2682242/public_html/includes/lock.inc(146): lock_may_be_available('theme_registry:...') #5 /home/a2682242/public_html/includes/theme.inc(449): lock_acquire('theme_registry:...') #6 /home/a2682242/public_html/includes/bootstrap.inc(446): ThemeRegistry->set(Array) #7 [internal function]: DrupalCacheArray->__destruct() #8 {main} thrown in /home/a2682242/public_html/includes/database/database.inc on line 2171

The site was working fine locally. I am not having much clue as to where the problem is. Is it some problem with the mysql server setting of my hosting provider? Or something else?

marked as duplicate by Bala, Letharion, Mołot, Krishna Mohan, mpdonadio Oct 25 '14 at 15:58

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3

Please try increasing your max_allowed_packet setting in MySQL.

Open my.cnf file & update max_allowed_packet = 16M or more

  • Yeah. This is also what I think is causing the error. The problem is that I am on a shared hosting. When I ask them to increase their limit, they say that other clients are not facing the problem and it's probably some problem with your Drupal. So, are you absolutely sure that the above problem can be fixed by changing the mysql setting? I would change the hosting in that case. – shivams Oct 17 '14 at 4:34
  • ya I'm 100% sure. – Nishant Oct 17 '14 at 4:36
  • My hosting server had max_allowed_packet set to 1M. Whereas my local server had it set to 16M. After I set my local server to 1M, I could replicate the problem locally. So, the problem was indeed due to max_allowed_packet. Thanks Samzha for your quick and confident response. – shivams Oct 17 '14 at 6:38
  • you welcome @shivams – Nishant Oct 17 '14 at 6:41
  • 1M is tiny. Even 16M can be insufficient for larger sites. For more info see some of the answers at drupal.stackexchange.com/q/31890/10729 – rooby Oct 22 '14 at 13:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.