2

When I try and do the 'database and media backup' on Magento it isn't show in my list in the backend.

I did my own research and some users suggested looking in the 'error_log', which I did, and it shows this for the time I tried to run the backup:

 PHP Fatal error: Call to a member function setErrorMessage() on a non-object in /app/code/core/Mage/Adminhtml/controllers/System/BackupController.php on line 140

I have looked at this file and on that line it shows:

 $backupManager->setErrorMessage($errorMessage);

Which seems to be correct. Does anyone have any ideas? I'm running Magento 1.7. Any help is greatly appreciated!

UPDATE: Since increasing the memory through the .htaccess file and the index.php it has backed up more according to my var/backups file as it shows at 129.7mb which is the most is has reached (usually it times out at 32mb or so). But it still shows as 'tmp' and a '.tar' file which doesn't show in my front end...?

2 Answers 2

2

You are running out of memory and/or exceeding the execution time limit. Try adding this to the top of your index.php:

ini_set("memory_limit","1024M");
ini_set("max_execution_time",14400);

If you can, try increasing the memory limit and execution time through your hosting control panel.

15
  • Thank you. I have tried doing this and have tried changing the memory limit in the .htaccess file but am still having no luck. The error log shows the same thing. Any other ideas? Commented Jan 26, 2015 at 5:50
  • Put phpinfo(); in a file and run it from a Web browser to make sure that your settings are working. Commented Jan 26, 2015 at 13:14
  • How do I do this exactly seanbreeden? Commented Jan 26, 2015 at 20:09
  • Create a file called "pi.php". Inside the file put <?php phpinfo() Then run the file from a web browser. Commented Jan 26, 2015 at 20:42
  • In the output of that file search for "memory_limit" and "max_execution" to make sure those values are actually set. Commented Jan 26, 2015 at 20:42
1

You might be limited to the hardware / settings of your hosting in which case you might have to take a different approach. If you're up to it you could accomplish this using SSH. If you've never done it before it can be a bit of a learning curve but very handy to know how to do. Here's an article with multiple ways to backup Magento.

Below are some easy ways to do essentially the same thing that Magento is doing but directly through SSH.

How to Backup Files

tar -zcf backup-YYYY-MM-DD-HH-MM.tar.gz public_html/

Replace YYYYMMDDHHMM with the date/time.That command will create a .tar.gz compressed file containing all the contents of your public_html directory. Might have to change public_html/ with the relative or full path to your Magento site's root directory. That would include all the Magento files including the media.

How to Backup Database

mysqldump --opt -Q -u {db_username} -p {db_name} | gzip > backup-YYYY-MM-DD-HH-MM.sql.gz

Again, replace with date/time in the file name and also replace {} with your database username and database name. You can get those by opening your app/etc/local.xml file and reading them from in there. Looks like this:

<host><![CDATA[localhost]]></host> 
<username><![CDATA[db_user]]></username>
<password><![CDATA[db_password]]></password> 
<dbname><![CDATA[db_name]]></dbname>

That would essentially get you the same thing as the built-in Magento backup tool. Takes a little more effort to restore from this backup but it's very effective.

Control Panel

Chances are your hosting provider has given you some type of cPanel or other control panel. You could also use this to download a database backup and home directory (files) backup.

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.