cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 1.9.2 error with backup tool site now not working

Magento 1.9.2 error with backup tool site now not working

I have recently installed magento 1.9.2 and all was going well so I decided to use the backup tool in the system options.

Well now my site and admin page are down and I have no idea how to get them back up.   My pages show a '500 INTERNAL SERVER ERROR" message.

I had this problem once before in older version and I renamed maintenance.flag file to .bak and site went back up.

 

However in this version I do not see a maintenance.flag file anywhere so I do not know what to do.

 

Can anyone please help?   I just put 5 hours of work onto site and want me work back.  All the work was adding categories and products so I didn't do anything to any settings or files.

 

Thank you,

Steven

8 REPLIES

Re: Magento 1.9.2 error with backup tool site now not working

Check the error log and see if anything in there.

you wont find a maintance.flag in this case.
Melbourne | Australia - priyan.d@webdesignace.com.au
My Magento 1x Shop

Re: Magento 1.9.2 error with backup tool site now not working

This is most likely due to the Magento backup tool resetting your file permissions to the default 666 for files and 777 for directories, which can cause issues in some hosting environments (666 and 777 are insecure permissions which is not recommended but Magento has it as default Smiley Indifferent). 

 

You will need to reset your file permissions. This is normally 644 for all files and 755 for all directories. 

 

I wouldn't suggest using Magento's built-in backup tool but if you still want to use it and want to avoid this issue, there's an interim solution to fix the issue. 

 

Important Note: This is a manual hack which may cause issues if you have done any customization to your Magento store and it will be overwritten during a Magento upgrade.

 

In your Magento directory, copy this file:-

lib/Mage/Archive/Helper/File.php

Into:-

app/code/local/Mage/Archive/Helper/File.php

Open the file File.php and look for this line:-

public function open($mode = \'w+\', $chmod = 0666)

Replace it with this line:-

public function open($mode = \'w+\', $chmod = 0644)

Save the file and the next Magento backup will reset all file permissions to 644 instead of 666.

James Lee | Moderator • Magento Master
See My Recommended Magento Hosting & Security Tips

Re: Magento 1.9.2 error with backup tool site now not working

Hi JLHC,

 

If I run magento on my local (MAMP PRO) server I have no problem using the internal Magento backup, but on my live-server I do have this problem.
The file

 lib/Mage/Archive/Helper/File.php

 is the same on both.

When I look at the permissions on my local MAMP they are indeed 0666 instead of 0644 on the live server.

 

Since my technical knowledge of servers is not super could/would you explain to me what I can tell my host to prevent this problem? Or do I simply edit the file?

 

 

Regards,

Henk

Re: Magento 1.9.2 error with backup tool site now not working

@henk64: This is not really a "problem" with the server environment. 

 

If your hosting provider doesn't allow anything more than 644 for files and 755 for directories (in which case they most likely run SuPHP or SuExec), you should be happy that they are actually taking security seriously. 

 

The problem is Magento's code will auto default to 666 for files after a backup, which are very insecure file permissions and should never be used unless absolutely neccesary. 

 

The workaround I stated in my previous post will change this behavior of Magento so after each backup, the files will be set to 644 instead. 

James Lee | Moderator • Magento Master
See My Recommended Magento Hosting & Security Tips

Re: Magento 1.9.2 error with backup tool site now not working

I don't see the file folders you are supposed to move the File.php file to. On my installation they don't exist. Am I supposed to add them?

Thanks.

Re: Magento 1.9.2 error with backup tool site now not working

@redqueensoft: May I know what Magento version are you using? 

James Lee | Moderator • Magento Master
See My Recommended Magento Hosting & Security Tips

Re: Magento 1.9.2 error with backup tool site now not working

CE 1.9.2 with New Security Patch (SUPEE-7405) and Release - 1/20/2016
installed. I found that the backup had changed the file permissions to 0666
and when I changed them back to 0644 it seems to work again. The problem is
that the backup changed all the files in all of the directories and caused
havoc on the other software programs we had loaded on the same root
directory. Is there a script I can use to change them back? Otherwise I am
going to be here working on this for a very long time.

Thanks for your help.

Re: Magento 1.9.2 error with backup tool site now not working

@redqueensoft: The guide I posted above should solve the issue. Let us know if you face any issues when implementing it. Smiley Happy

James Lee | Moderator • Magento Master
See My Recommended Magento Hosting & Security Tips