Using Backup and Migrate module on a D7 site

  • separate backups (data / files) give no problem (backup to nodesquirrel AND download)
  • but backup entire site (data + files) generates "http error 500" (without "internal server error")

Error reporting

  • I have no access to Apache error log
  • Cpanel error: no error messages
  • Drupal error log: no error messages

Shared hosting | db 10.1.21-MariaDB | php 5.6.30 | drupal 7.53 | backup and migrate 7.x-3.1 | civicrm 7.x-4.7.14


The web host provider received next message:

 Uncaught exception 'PDOException'
 with message 'SQLSTATE[HY000]:
 General error: 2006 MySQL server has gone away'
 in <drupal root>/includes/database/database.inc:2227
 Stack trace:
 #0 /includes/database/database.inc(2227): PDOStatement->execute(Array)
 #1 /includes/database/database.inc(697): DatabaseStatementBase->execute(Array,  Array)
 #2 /includes/database/database.inc(2406): DatabaseConnection->query('SELECT expire, ...', Array, Array)
 #3 /includes/lock.inc(167): db_query('SELECT expire, ...', Array)
 #4 /includes/lock.inc(146): lock_may_be_available('schema:runtime:...')
 #5 /includes/bootstrap.inc(433): lock_acquire('schema:runtime:...')
 #6 /includes/bootstrap.inc(455): DrupalCacheArray->set(Array)
 #7 [internal function]: DrupalCacheArray->__destruct()
 #8 {main} in <drupal root>/includes/database/database.inc on line 2227
  • It's hard from this data to point to anything. But if a smaller backup works, I'm leaning towards memory. Instantiate top and try creating it. If it's not memory, maybe a timeout. For both, check your apache configuration.
    – rovr138
    Commented Mar 11, 2017 at 23:44
  • @rovr138 I added the error message received by the web host provider
    – MarkDQ
    Commented Mar 13, 2017 at 14:33
  • That MySQL error is usually due to reaching a limit on MySQL. You're going to have to break it into chunks. Would running backup-and-migrate locally be an option? You can use mysqldump to get a database and run your process locally.
    – rovr138
    Commented Mar 13, 2017 at 14:38

2 Answers 2


This is your error:

General error: 2006 MySQL server has gone away

You can try to fix this in two ways:

  1. my.ini

Open your my.ini file and locate max_allowed_packet. By default this is 1M. Setting it to 16M and restart your MySQL server. If the problem persists, try setting it to 512M and restart your MySQL server.

  1. MySQL prompt

Enter your MySQL prompt, log in as user root or as a user with the SUPER privilege. Run the following command:

SET GLOBAL max_allowed_packet = 1024 * 1024 * 512;

This method doesn't require you to restart the server.

  • I cannot edit my.ini nor do i have super privilege in my shared host. The max_allowed_packet is 16777216.
    – MarkDQ
    Commented Mar 13, 2017 at 15:56
  • That's 16MB which clearly isn't enough. Can you ask your hosting provider to increase that value? Commented Mar 13, 2017 at 16:01
  • It's 16 777 216 bytes = 16 MB. Commented Mar 13, 2017 at 20:58
  • The web host server provider says the unit is KB. So 16 777 216 is 16GB. Is this correct?
    – MarkDQ
    Commented Mar 13, 2017 at 21:12
  • Sorry, i replaced my comment without seeing yours: the number is in bytes, not KB.
    – MarkDQ
    Commented Mar 13, 2017 at 21:15

You are most likely hitting a resource limit. Enable PHP error logging in the index.php file so you can get an error output. But most likely it's a memory issue or a timeout issue which you will need to make adjustments in your PHP.ini file to fix them.

It sounds like it's specific than to your MySQL limits. Try increasing your packet size.

Here is a link that describes a similar issue with some possible solutions. https://www.drupal.org/node/259580

  • both are set to:memory_limit = 2G max_execution_time = 600
    – MarkDQ
    Commented Mar 13, 2017 at 14:40
  • Are those numbers being respected though? If you create a phpinfo file in your directory and navigate to it, does it match the resources? With shared servers the local php.ini file doesn't always get places above the systems. I've also updated my answer since you provided some error messages. Commented Mar 13, 2017 at 14:45
  • Yes, both values match when i execute phpinfo() in a test php file. The shared server provides the possibility to change some values.
    – MarkDQ
    Commented Mar 13, 2017 at 14:51

Your Answer

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

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