Difference between revisions of "Why can't you install any extensions?"

From Joomla! Documentation

Line 38: Line 38:
  
 
If you choose to use the FTP layer and you still have trouble, reupload the Joomla! 1.5 package onto your server using your FTP client and the FTP user that you specified in Joomla!'s global configuration.  If your FTP client reports permission problems when trying to do this, contact your host for further assistance.
 
If you choose to use the FTP layer and you still have trouble, reupload the Joomla! 1.5 package onto your server using your FTP client and the FTP user that you specified in Joomla!'s global configuration.  If your FTP client reports permission problems when trying to do this, contact your host for further assistance.
 +
 +
=== File ownership advice from srgb ===
 +
 +
I was stuck with the same issue and found a cool solution.
 +
You may use the FTP to upload files and Apache/PHP user for Joomla, you just need to do some preparation:
 +
 +
Right after the extraction of Joomla_install_xxx.zip file into your website's root dir, change file permissions recursively to 4770 (suid bit lets Joomla pretend it's a directory creator):
 +
 +
<pre>chmod -R 4770 /path/to/root/htdocs/dir
 +
</pre>
 +
 +
Later, change Joomla script a bit to create all new dirs with the same perms (in libraries/joomla/filesystem/folder.php):
 +
 +
<pre>function create($path = '', $mode = 4770)
 +
</pre>
 +
 +
That's all, enjoy your Joomla!
  
 
==== Web hosting advice from HarryB ====
 
==== Web hosting advice from HarryB ====

Revision as of 07:00, 2 November 2010

There are several different issues that can cause this problem, depending on your Web hosting environment.

PHP Version[edit]

If your site is using PHP 5.0.4 this problem will occur. You need to ask your host to upgrade to a newer version of php. Joomla! does not work with PHP 5.0.4, there is no work around.

Tmp and session paths[edit]

One common problem with remote hosts is that they sometimes move sites to different folders on the host server. In general, this does not cause obvious problems in Joomla!. However, when you install an extension, you need to be able to write to the "tmp" directory.

In this case, you might get the error message: "JFolder::create: Could not create directory" and "Warning! Failed to move file." If you have the Joomla! FTP layer enabled, you might get the message "JFTP::mkdir: Bad response, JFTP::chmod: Bad response, JFTP::store: Bad response, Warning! Failed to move file."

tmp directory: An incorrect tmp directory can cause this problem. To check this, look in your configuration.php file for the var $tmp_path value and make certain it matches your actual path. This must be writable to Joomla!.

Session path: The session.save_path directive in your php.ini file must be writable. To verify, use the Forum Post Assistant. If it reports save.session_path: Not Writable then there is a problem. Look at your php.ini directives and verify the location and the permissions of the session.save_path value. It must be a valid location and it must be writable for Joomla!. You may require the assistance of your Web host for this, depending on your Web hosting situation.

php.ini: You could also check your php.ini file, main file is generally under /etc directory. If you can edit this file, you can set open_basedir to include the temp directory: open_basedir = /tmp. If you have another path included, as suggested by security settings for Joomla!, you can add additional paths by adding :/path. An example: open_basedir = /var/www/html:/tmp.

File ownership advice from ianmac[edit]

At the heart of the issue is file ownership. There are generally two main server users that end up owning your files - the FTP user, and the Apache/PHP user. Obviously, when you upload files using FTP, the FTP user ends up owning them. Therefore, if you give a file 755 permissions, then ONLY the FTP user can write to that file.

If you install Joomla! without the FTP layer, then the files it creates are owned by the Apache/PHP user. If you give the file 755 permissions, then ONLY the Apache/PHP user can write to that file.

Just to emphasize, the fact that these username and passwords happen to be the same has no effect whatsoever on anything. They are different subsystems and are unrelated. It may be convenient, but will not solve your permission issues.

So there are generally two approaches to take:

  1. upload all the files via cpanel. This will generally result in all of the files being owned by the Apache/PHP user. Ensure that the root directory that all of your Joomla! files are installed in is writable, so that the installer can create the configuration.php file. Then, install Joomla! WITHOUT the FTP layer.
  2. upload all the files using FTP. This will generally result in all of the files being owned by the FTP user. Make sure that your Joomla! root directory is writable, again, so that the installer can create the configuration.php file. Then install Joomla! WITH the FTP layer.

Ensure that your cache folders are owned by the Apache/PHP user, because these files are written by PHP. (cache because writing using the PHP user is much faster than via FTP.

If you apply these principles - and choose either the first or the second approach, you should get better results and extension installation should work properly via the admin interface. Mixing the two approaches will cause you no end of grief.

A good way to check that everything is in order is to browse to the Administrator section of your site and browse to Help->System Info from the menu. Click on directory permissions.

If you don't have the FTP layer enabled, it is important that everything show up as Writable. If you do have the FTP layer enabled, then it is important that your two Cache directories show up as writable. It is most likely okay that the rest show up as unwritable, because Joomla! can likely write these files using the stored FTP settings.

If you choose to use the FTP layer and you still have trouble, reupload the Joomla! 1.5 package onto your server using your FTP client and the FTP user that you specified in Joomla!'s global configuration. If your FTP client reports permission problems when trying to do this, contact your host for further assistance.

File ownership advice from srgb[edit]

I was stuck with the same issue and found a cool solution. You may use the FTP to upload files and Apache/PHP user for Joomla, you just need to do some preparation:

Right after the extraction of Joomla_install_xxx.zip file into your website's root dir, change file permissions recursively to 4770 (suid bit lets Joomla pretend it's a directory creator):

chmod -R 4770 /path/to/root/htdocs/dir

Later, change Joomla script a bit to create all new dirs with the same perms (in libraries/joomla/filesystem/folder.php):

function create($path = '', $mode = 4770)

That's all, enjoy your Joomla!

Web hosting advice from HarryB[edit]

There are some techniques used by some Web hosts that make this easier for novices. HarryB, longtime community member, has this advise for those of you who are not experts in security issues, and do not wish to invest time in that learning, and are considering finding a Web host environment that will allow you to avoid these scenarios:

When looking for a host, ask if they implement phpsuexec and php-cgi. if they do, that's a good way to go as the ownership/permission issues in this environment will probably be far more manageable than they are when using the Apache php module (mod_php).

Empower yourself with knowledge and accept responsibility for your Web sites[edit]

It is in your best interest to empower yourself with knowledge and facts and take full responsibility for your Web sites. Please, do not expect Joomla! forum volunteers to research your specific Web hosting situation and explain to you how to use environment. There are simply too many ways that hosting can be configured and too many Web sites for volunteers to do this for you. Work with your hosting environment. That is why you are paying them. Be respectful of this limitation, please, since it can be a real drain on volunteers. Forum volunteers are here to assist and cannot be expected to do your work or the work of your Web host for you.