How to solve permission problems with Joomla! when you install it on your own

 Setting the ownership correctly

There are already detailed explanations out there about permission problems you encounter when you use Joomla!, but I find it a bit difficult to find a straight forward answer to the specific problem I had. So I decided to write a short post about it. Come to think about it, it really is something basic and easy to figure out if you have a bit of experience. But when you are stuck, you just can't see the simplest solution.

This solution applies especially when you :

- have your own plain Linux server (physical or VPS) and full SSH access.

- installed Joomla! 2.5 on your own.

I do everything with SSH so I am not familiar with tools like cPanel but regardless of the way you configure the server, the concept is essentially the same.

Set the owner of all the files and directories to the user who executes Joomla! and everything will work fine!

This user is the one who executes PHP. Most of the problems concerning the permissions come from the situation where the user who is executing PHP is neither the owner of the Joomla! related files and directories nor in the group of the owner.

- If you are using Apache HTTP server, the user is usually apache. But it will vary depending on your server setting. Check httpd.conf if you are not sure. In my CentOS 6.3, it's /etc/httpd/conf/httpd.conf

User apache
Group apache

 

- If you are using nginx + php-fpm, check the configuration file of php-fpm (not the one for nginx). In my environment, it's /etc/php-fpm.d/www.conf and somehow, the executing user is set to 'apache' instead of 'nginx'.

user = apache 
group = apache

 

Just in case you forgot how to change the ownerships of the files, there's the command:

chown -R apache:apache .

If you preserve the original permission settings when you installed Joomla!, there's nothing more you have to do. However, if it still doesn't work, try setting permission 644 to files and 755 to directories.

And you are good to go!

Errors you can solve by this solution

If you are seeing these errors, you most likely have the permission problem I described above.

'Error' when you try to remove installation folder on the last page of setup steps and see the following message:

PLEASE REMEMBER TO COMPLETELY
REMOVE THE INSTALLATION FOLDER.
You will not be able to proceed beyond this point until the installation directory has been removed. This is a security feature of Joomla!.

Can't save the configuration file

Could not save data. Error: Could not write to the configuration file

Can't install extensions

Warning: Failed to move file!
JFolder::create: Could not create directory
Component Install: Failed to create site directory: /usr/apps/j3/components/com_paypalbtns
Error installing component

Can't save template, css, js files etc.

Could not save data. Error: An error occurred. The file index.php could not be saved.

 Hope this helps!