Magento permissions changes after system backup - cause 500 error

I am having problems with Magento while performing a system backup. Each time I make a system backup, Magento changes the file permissions and causes a 500 server error when the backup completes and the administrator screen reloads.

The problem is the same as in this unanswered question. I do not set the maintenance mode .: https://stackoverflow.com/questions/13107963/magento-file-permissions-changing-to-chmod-666-after-system-backup

Can someone tell me how to stop this? It is a pain to have reset permissions every time I backup.

+6
source share
1 answer

The problem arises because Magento Backup sets file permissions.

The negative part of lib/Mage/Archive/Helper/File.php

In it you will find the function public function open($mode = \'w+\', $chmod = 0666)

This causes problems when permissions change globally.

If you must use backup of the Magento site, then you must run the script to set the rights to the file / folder back.

Ssh commands (can be executed as a shell script)

For Magento, where PHP works through FastCGI, suPHP or LSAPI:

 find . -type f -exec chmod 644 {} \; find . -type d -exec chmod 755 {} \; chmod 500 pear chmod 500 mage #for magento 1.5+ 

For Magento, where PHP works as a DSO module under Apache:

 find . -type f -exec chmod 644 {} \; find . -type d -exec chmod 755 {} \; chmod o+w var var/.htaccess app/etc chmod 550 pear chmod 550 mage #for magento 1.5+ chmod -R o+w media 

In order for Magento to function, var / and media / may need to be set to 777 recursively

On the rights settings page of MagentoCommerce , which also has a php script linked about half down, which you can run to set permissions.

Another option is to flush the Magento backup system and do it your own way with tar and mysqldump . Note. this will require a lot of free space for temporary storage of the tar file until it is downloaded, unless you exclude the media / folder and back up the media folder in another way.

 tar -czf magentobu.tgz --exclude="public_html/var/*" --exclude="public_html/media/catalog/product/cache/*" public_html mysqldump -u $USER -p$PASS $DBASE > magentodb.sql 

And copy the received files to your external storage, be it your workstation, S3 bucket or vps.

Another option is to set up a system where you can rsync use your Magento system, and also pull out the mysql dump file created once a day. At the same time, you can have a continuous mirroring of the full site, which does not require additional storage space on the server, while you wait to pull out a backup copy outside the site.

+5
source

All Articles