Joomla FTP Layer: Common Problems And Solutions
Rather than writing an extensive post detailing all the steps needed to enable the FTP layer in Joomla, I will give a brief overview of common problems that are encountered in this process. Much of the tips will be taken from other authors (of course with credits where due).
A short introduction
The FTP layer was introduced in Joomla 1.5 as a solution to a common problem: file and folder permissions on Linux hosts. When Joomla is transfered using an FTP client, all files and folders will be owned by the FTP user. Installing a Joomla template or Joomla extension using the administrator with ‘Enable FTP’ set to ‘No’ in the Global Configuration, will attempt to create files owned by the Apache/PHP user. When using the FTP layer, templates and extensions that are uploaded will be owned by the FTP user, preventing any differences in file ownership.
While the solutions below will likely resolve most of the issues you’ll encounter, the FTP layer is still a patch to a problem rather that a solution. For a couple of years now, there has been a meta solution for the problem above called suPHP. This tool will make sure PHP scripts are executed with the permissions of their owners. If possible, try to have your host install this tool before using the Joomla FTP layer as a patch.
Do NOT use the FTP layer on a Windows server
Windows servers do not have the problem described above, so trying to use the FTP layer in a Windows environment will not resolve any of the problem you might encounter when you are trying to install templates or extensions.
Do NOT use CHMOD 777
Many times the problem with permissions is solved by webmaster by changing the CHMOD to 777. While this will most likely solve the immediate problem with the file permissions, it opens your website open to many types of attacks and exploits. Use CHMOD 777 as a final resort when no other solution works, and preferably change the relevant CHMODs back to safer a setting (755 for folders and and 644 for files) after you’ve uploaded your template or extension. With that said, I will now proceed to explain more about the FTP layer in Joomla.
FTP related variables to change
Below are the variables in the configuration.php file that are related to the FTP layer. Each of them will be discussed briefly, with hints to the most likely value that you’ll want it to set on.
This determines whether the Joomla FTP layer will be used or not. The value ‘0’ means off, changing this value to ‘1’ will turn it on.
Nine times out of ten this should be set to ‘127.0.0.1’ or ‘localhost’ (which are identical). This means the FTP host is on the same server as the Joomla installation.
Should be set to ’21’ as it is the FTP (File Transfer Protocol) port, SFTP (Secure FTP) however will generally use port 22.
The username of the FTP user you are using. While creating FTP users is outside the scope of this blog, there are great tutorials on the internet. Trying Googling for ‘creating a new ftp user’ or visit this tutorial.
The password of the FTP user you are using.
The root folder for the FTP. This is usually ‘/public_html/’ or ‘/’. When you connect to your FTP and have to click on a folder named ‘public_html/’, the value should be ‘/public_html/’, otherwise it should be ‘/’.
Common problems and solutions
Errors with the FTP layer often include notices as ‘Warning! Failed to move file’ and ‘Unable to find install package’ accompanied by (often vague or too general) error messages. Several of those error messages as discussed below, with solutions to (hopefully) resolve them.
Problem: Message ‘Unable to Find Install Package’
– Edit the configuration.php file manually instead of using the ‘Global Configuration’ in the Administrator. The Administrator sometimes fails to update the data in the file configuration.php, but still reports the message ‘The Global Configuration details have been updated’ (MissVicky).
Problem: Message ‘JFTP::store: Bad response’
– Change the variable $tmp_path from ‘/tmp’ to the full path of your tmp directory, for example ‘/home/example.org/public_html/joomla/tmp’. The same logic applies to the variable $log_path. If you do not know the full path to your /tmp folder, you should be able to find it by navigating to it using an FTP client, or be following the instructions in this doc. As said before, ignore the advice about CHMOD 777 in that document whenever possible.
– Make sure the $ftp_root variable is set correctly. For example, if your Joomla is installed in a subdirectory, this variable should be set to ‘/public_html/subdirectory/’.
Problem: message ‘JFTP::login: Unable to login’
– Double check the username and password you entered. Sometimes the username has to be entered as ‘email@example.com’ instead of just the username ‘example’ you created as a new FTP user.
Problem: message ‘JFTP::connect: Could not connect to host “www.example.org” on port 21’
– On the majority of the servers the value of $ftp_host should be ‘localhost’ or ‘127.0.0.1’ (which are equivalent). If this does not resolve the problem, try contacting your hosting provider and ask for the FTP host you should connect to with your account.
Problem: messages ‘JFTP::mkdir: Bad response, JFTP::chmod: Bad response, JFTP::store: Bad response’
– Make sure the FTP user you created/selected has permission to create files and folders (Ooffick)
– Try uploading the Joomla files using an FTP client rather than via cPanel, Fantastico or Installatron. This will make sure the Joomla files are owned by the FTP user, which matches the FTP user that is being used when the FTP layer is activated (Ianmac).
Problem: the ‘Extension Manager’ bounces you back to the Control Panel of your Administrator
– Try raising the value of the variable upload_max_filesize in your php.ini file. When this value is too low, the server will bounce the request to upload, and send you back to the main page without showing an error at all.
Problem: feeds cannot be published because the ‘cache/’ directory is unwritable
– The Apache/Nobody user is doing these write actions. To enable write access to the cache/ directory (without setting the CHMOD of the folder to 777) you should install the JoomlXplorer component and remove the cache/ folder afterwards using the FTP account that was used to upload Joomla. Using JoomlXplorer you can now create a new cache/ directory (with Apache/Nobody user rights, because JoomlXplorer is using the as well) and set the CHMOD of the cache/ folder to 755.