Why I'm getting MySQL error that server has gone away? I'm running:
Drupal 7.34,
PHP 5.4.16,
MySQL 15.1 Distrib 5.5.41-MariaDB, for Linux

I am getting a WSOD on just the module page after a move of server, everything else seems to be running ok.

I've added:

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


to index.php and see the below errors:


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

First, it's potentially one of your contrib modules causing the problem, so option 1 would be to use Drush to disable all non core modules:

drush pml --no-core --type=module --status=enabled --pipe | xargs drush -y dis

After running this, there is a good chance that you can access your modules page again and be able to start enabling modules one by one to pinpoint the culprit.

Option 2 would be to check mysql's MAX_ALLOWED_PACKET.  You can check this by running SHOW VARIABLES LIKE 'max_allowed_packet' in your mysql console.  If it is set at 1MB, you can try raising it to 16M by running SET GLOBAL max_allowed_packet=16777216;. Try loading your page again to see if that was the issue.