File permissions for MageBridge
MageBridge relies on the correct setup of file-permissions within both Joomla! as Magento. If file-permissions are not setup correctly, the upgrade of MageBridge will fail. This document helps you analyze this problem. Please note that if the hosting environment is not correctly setup, we will be unable to support MageBridge.
File permissions in general
PHP-applications like Joomla! and Magento can easily be extended by using a GUI to install new extensions. Within the Joomla! Administrator you can find the Joomla! Installer component, while Magento ships with the Magento Downloader application. Both systems rely on proper file permissions to install new files or overwrite existing files correctly.
The PHP-process is run with certain privileges, and these privileges need to include the ability to write files. Within Windows, these permissions rarely cause problems, but there are many Linux-based hosting environments that do have issues. This is mainly due to a bad setup of such a Linux server.
Conflict between FTP and webserver
Within Linux environments, the Apache webserver is run with a specific UNIX-user, but if files are being placed within the webspace through FTP, a different UNIX-user might be used. In this case, the owner of the files is not the Apache user but the FTP-user instead. There for, the Apache user might have trouble writing to these files or directories. This can be a huge problem.
When MageBridge is installed, you need to upgrade the MageBridge Installer to the full version. If permissions are incorrect, Apache will be unable to create new files and the MageBridge upgrade will fail. This is not due to MageBridge itself, but due to a faulty hosting environment.
Partial file uploads
When the MageBridge upgrade fails, chances are that some files are not correctly added to either Joomla! or Magento. Below you can find a listing of files of a full MageBridge version in both Joomla! as Magento. Not all files are listed, but the listings give you a good idea how to detect if something is missing.
Joomla! files and directories:
components/com_magebridge
administrator/components/com_magebridge
modules/mod_magebridge_menu
modules/mod_magebridge_products
plugins/system/magebridge.php
plugins/system/magebridge.xml
plugins/authentication/magebridge.php
plugins/authentication/magebridge.xml
Magento files and directories:
magebridge.php
app/ec/modules/Jira_MageBridge.xml
app/code/community/Jira/MageBridge/
app/design/adminhtml/default/default/template/magebridge/
Solutions
The only recommended solution is to choose a hosting environment where the Apache-user matches the owner of all the Joomla/Magento files. The following options are available:
- Apache is configured to run as the FTP-user
- All files are owned by the Apache user
- Apache is shipped with the mod_ruid or mod_ruid2 module
- PHP is run using SuPHP (mod_suphp)
- PHP is run using FastCGI (mod_fastcgi) with SuExec enabled
- PHP is run using CGI (mod_cgi) with SuExec enabled
No solution?
If your hosting provider does not offer one of the solutions mentioned above, this provider actually does not know how to run modern PHP-applications (Joomla!, Magento) properly. We highly recommend you switch environment to a Magento- or Joomla!-optimized hosting platform.
Alternatively, Joomla! offers the extra option of a so-called FTP Layer, which makes sure updates are performed using the FTP-user, instead of the Apache user. This is not a solution that we can support. Also note, that this workaround does not exist under Magento.
If you have your own dedicated server (either physical or virtual) we can help you solve this problem. There is a small fee involved and root-access is required. Contact us through mail for more information.
World-wide writable permissions
We do not recommend setting file-permissions to mode 666 or 777, because this will not fix the problem of new files being created during updates. Also, it might introduce serious security issues.
We can only support world-writable permissions if newly created files are getting these permissions as well. This only works if the umask() is properly set. In Magento, the umask() can be modified by editing the main index.php file:
umask(0);
A common change is to modify it to 0022:
umask(0022);
In Joomla!, the umask() can not be modified. If you have problems due to world-writable permissions, we will not be able to support this on Joomla! environments.
You can also ask your hosting provider to change the default umask(). If they require you to use a specific permissions-set, and the umask does not reflect this, you can even tell them they haven't done their job - besides causing the permissions-problem itself.
Our support
If a hosting environment is incorrectly setup regarding file permissions, we will be unable to provide support. Such a hosting environment will there for be marked as unsupported. Please note that such an environment is most likely not optimized for Magento anyway, so by switching to a Magento-supported environment you will save yourself a nightmare anyway.
Created on Tuesday, 16 March 2010Modified on Tuesday, 25 January 2011
More tutorials in this section
- MageBridge caching
- Two VirtualHosts but one domain
- Moving a MageBridge site
- File permissions for MageBridge
- Questions to ask your hosting provider
- Switching stores with MageBridge
- Prevent direct access to Magento using htaccess
- Enabling SSL for MageBridge
- MageBridge Security Guide
- Upgrading Magento, Joomla! and MageBridge
- MageBridge scenarios
- Performance tuning with MageBridge
- Finding a good hosting provider
- Using MageBridge in TurnKey appliances
- Using the MageBridge-optimized TurnKey image
- Benchmarking MageBridge performance
