Drupal Error : The website encountered an unexpected error. Please try again later 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?
Please try increasing your max_allowed_packet setting in MySQL.

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