Closed (outdated)
Project:
Backup and Migrate
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 Sep 2015 at 13:28 UTC
Updated:
26 Nov 2025 at 13:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
duncan246 commentedI discovered that max_execution_time was being overwritten by the following code, which appears in the functions backup_migrate_perform_restore and backup_migrate_perform_backup:
The workaround was to add the value set_time_limit to the directive disable_functions in the php.ini. It took two hours but, after this, the database restored successfully. (Remember that the php.ini file to be changed may vary according to whether php is being called via the browser or via the command line.)
Comment #3
claudio mateluna commentedHi, any chance that you can explain a step by step for the solution you find? It will be much appreciated
Comment #4
hgoto commented@duncan246, thank you for sharing this issue.
Here is a patch for the version 7.x-3.x to avoid overwriting unlimited max time (0). Since Backup and Migrate for Drupal 8 doesn't use this logic, the version 7.x-3.x is the latest one we can create a patch, I believe.
I hope someone would test the patch with Backup and Migrate version 7.x-3.x. Thank you in advance.
Comment #5
couturier commentedThis patch will need to be reviewed based on the latest 7.x-3.2 release.
Comment #6
junro commentedHello,
I have exactly the same problem.
I can't restore my database.
I increase max_execution_time = 3600 & max_input_time = 3600.
I have the error message 20/25 minutes after the restoration begin.
So I guest it's not a problem with max_execution_time...
With Drupal 6.x, I didn't have this problem.
My website error_log file :
[Fri Jan 05 17:52:01 2018] [error] [client xxx] Script timed out before returning headers: index.php, referer: ww.xxx.com/admin/config/system/backup_migrate/settings/destination/list/restorefile/manual/xxx-2018-01-05T14-48-26.mysql.gz
I tried with backup & migrate 7.3.3 & 7.3.dev
Comment #7
junro commentedPatch works , but not with the 3.3 version, only with the dev version.
AND I can't backup anymore, I have to delete the code patch...
Comment #8
couturier commentedSounds like this patch is going to have to be rewritten.
Comment #9
junro commentedHTTP ERROR 500 after 3.5 upgrade.
Comment #10
couturier commentedThis isn't a solution, just an observation: with the release of Drupal 8, most of the larger websites using Drupal are beginning to move toward alternate backup options rather than the Backup and Migrate module which was so popular for D7 and previous versions. If someone's database is so large that it is timing out with a Backup and Migrate backup, perhaps they would have alternate command line options for backup that would better suit the needs of the database?
Quite a few of us who are intensely interested in seeing Backup and Migrate move forward for D8 and beyond don't have command line access and/or use a shared hosting environment where a module for backup is imperative. With development resources limited for this module, I suggest we work on this bug only if it also applies to the D8 version, since D7 will eventually become unsupported.
Comment #11
damienmckennaComment #13
HaloFX commentedFrom reading #2, it sounds like this effects backup and restore functions, am I correct?
My apologizes if my situation is not related.
I have a D7 site currently using BaM 3.5. I am backing up the database, and the files in separate tasks to S3. The database is about 5mb and backups fine in a matter of seconds. The files are just over 50gb. They backup and transfer to S3 in about 30 minutes. I get 2 messages from the task, one stating it completed, and a few seconds later a message stating the backup failed due to a PHP max_execution_time error. PHP max_execution_time is currently set to 3600 in /etc/php/7.0/apache2/php.ini.
Comment #14
couturier commented@HaloFX Do I understand correctly that you are working off of an Amazon system? It could be something related to that if so. The Backup and Migrate issues queue has several issues related to problems with that. If it is a simple timeout error then this patch might help if we can get it working. Note that we do also have several other issues related to timeout errors, so you might want to check the queue to see if anything else might provide some help.
Comment #15
HaloFX commentedIn my case, the site is on Digital Ocean, and backups to S3.
I also realized I didn't make it clear that in most cases, the backup appears to be OK, but still reports a timeout error.
Comment #16
couturier commentedIt is likely a timeout issue as your error states, but I am concerned that if you're backing up to S3, you could be having additional issues. See these other discussions as linked to rule them out. DigitalOcean coordinates with Amazon, and we've seen problems with the Backup and Migrate module version 7.x working well with that.
Comment #17
damienmckennaPlease test out the latest 7.x-3.x codebase, see if the recent changes help any.
As mentioned above, it's also worth considering just using native database tools to restore the backup, they don't run through the web server and PHP so it should be less likely to trigger timeouts.
Comment #18
brankoc commentedThe issue from comment #15 by HaloFX seems more closely related to "Timed out error, but backup successful backup".
The warnings at the end of the message from the issue starter, "Cannot modify header information - headers already sent by [...]" are unrelated to the main issue and have to do with the B&M script being called from cron - an anonymous user apparently does not establish a session. This error message is discussed in "Warning: session_encode(): Cannot encode non-existent session in backup_migrate_shutdown()" (which has a patch, but hasn't been committed at the time of writing).
Comment #19
brankoc commentedI tried to reroll the patch, only to find that similar code was already present in B&M 7.x-3.6.
It appears that when issue 2829492, Big file backup breaks with "MySQL server has gone away", tried to solve a different problem, that solution also changed the one thing that the patch of the current issue changes, namely turning set_time_limit() into drupal_set_time_limit().
The current patch adds a comment "// drupal_set_time_limit() doesn't overwrite limit 0 (unlimited) since Drupal 7.40" to explain why drupal_set_time_limit() should be used, but I am not sure if the lack of that comment in the current stable module should count as a failing.
I suggest this issue be closed.
Comment #20
ivnishDrupal 7 is EOL. This issue will be closed.