Magento Filesystem Permissions

This shows you the differences between the selected revision and the current version of the page.

1_-_installation_and_configuration:magento_filesystem_permissions 2013/08/28 18:38 1_-_installation_and_configuration:magento_filesystem_permissions 2012/05/04 03:01 current
Line 1: Line 1:
 +====== Magento Filesystem Permissions ======
 +This article will explain the file and folder permissions required by Magento.
 +
 +===== General Concepts =====
 +
 +==== UNIX File Permissions ====
 +
 +If you are not familiar with UNIX style permissions, please read one of the articles found here:
 +
 +[[http://www.google.com/search?q=unix%20permissions]]
 +
 +==== Web Application File Access ====
 +
 +Magento is a web application, or set of scripts.  These scripts are interpreted by a PHP executable, which, in turn, is invoked by a web service process (ex. Apache).
 +
 +Magento will have as much access permission to the file system as the User under which PHP executable was invoked.
 +
 +=== PHP as mod_php module Environment ===
 +
 +If Apache is configured to run PHP using mod_php module, then Magento will be run using the same permissions as Apache (ie, apache, nobody)
 +
 +In this case the simplest way to make necessary files writable is to give them 777 (world writable) permission, although this is by far not very secure.
 +
 +The other possibility is to assign the files apache process' user's group permissions (apache or nobody), and set permissions to 664 for files and 775 for folders. 775 for files will work too.
 +
 +Note: To do this via SSH, go to the directory where Magento is installed. Once you are there, copy and paste the following command:
 +
 +<code bash>find . -type d -exec chmod 775 {} ;
 +find . -type f -exec chmod 664 {} ;
 +</code>
 +
 +
 +=== PHP in suEXEC/suPHP Environment ===
 +
 +If apache is configured to use suEXEC ([[http://httpd.apache.org/docs/1.3/suexec.html]]) or suPHP ([[http://www.suphp.org/]]) then it will run under the same user you use for FTP or shell access. This will be possible only with CGI or FCGI (FastCGI) configured.
 +
 +With this configuration, all entry point PHP scripts (files that are directly accessed by apache: for example, index.php, js/proxy.php) and the folders within which they are located cannot have world writable permissions, or an Apache Error 500 will be thrown.
 +
 +Because all of the files are writable by the same User as FTP and shell, there's no need for any special permissions.
 +
 +===== Operating Requirements =====
 +This is a major security flaw!
 +Setting all the files & folders to 777 will make them writable by everyone.!
 +
 +==== Normal Operation ====
 +
 +For the normal operation or installation of a Magento store, only 2 folders need to be writable:
 +  * **/media** - for web accessible files, such as product images
 +  * **/var** - for temporary (cache, session) and import/export files
 +
 +==== Installation ====
 +
 +During installation Magento Install Wizard will create **app/etc/local.xml** file which contains database configuration and global encryption key for your Magento copy.
 +
 +Meaning **app/etc** folder has to be writable to web service.
 +
 +==== Web based MagentoConnect manager ====
 +
 +If you wish to use web based downloader for installation, upgrades or MagentoConnect extensions installation, you will need to have write permissions on ALL magento files including the root Magento folder.
 +
 +Files and folders will need to be returned to 655 non-writable permissions after installation.
 +
 +Alternatively, if you do not like to make all files and folders writable to the web service, it is possible to install and upgrade Magento from shell, using command line PEAR instructions, such as:
 +<code>
 +# all commands are to be ran from the root Magento folder.
 +# help on all available PEAR commands:
 +./pear help
 +
 +# set preferred stability for installed/upgraded packages (alpha,beta,stable):
 +./pear config-set preferred_state beta
 +
 +# initial installation from downloader package:
 +./pear mage-setup .
 +./pear install magento-core/Mage_All_Latest
 +
 +# install additional extension:
 +./pear install magento-community/Some_Extension
 +
 +# list available upgrades
 +./pear list-upgrades
 +
 +# upgrade a package
 +./pear upgrade magento-core/Mage_Package
 +
 +# uninstall a package
 +./pear uninstall magento-community/Unwanted_Package
 +</code>



 

Magento 2 GitHub Repository

Magento Job Board - Some sort of tag line goes here

Latest Posts| View all Jobs