How to change the path to your Temp Directory in Joomla 3.1

One of the settings available in Joomla 3.0 is the Path to Temp Folder. It’s safe to assume that this temporary folder is used for miscellaneous purposes, and the files stored in this folder are most likely deleted or moved to a more permanent location almost immediately after being put in the tmp folder.

 

What is the Temp Folder used for?

In an attempt to find out what the temp folder is used for, we changed the permissions of the folder to 000, so that no files could be written to it. We then ran a few tests to find out what processes use the temp folder, as they should report an error because of the changes we made.

The tmp folder is defined here:

File: configuration.php
Variable:
public $tmp_path = '/home/bradm/public_html/github2/tmp';

Components within Joomla can reference this setting by use of the following code:

JFactory::getApplication()->getCfg('tmp_path')

We scanned all the files in Joomla that reference the temp folder, and it appears that in most cases, the tmp folder is used to extract compressed files. For example, if you upload a component in a .zip format, Joomla will use the tmp folder to first unzip the contents of the file.

 

What error do I get if there is a problem with the Temp Folder?

In our testing, when we removed all permissions from the temp folder and tried to upload a Joomla module in a .zip format, Joomla 3.0 gave us the following errors:

no-permissions-on-tmp-folder

Warning
Warning: Failed to move file!

JFolder: :files: Path is not a folder. Path: /home/bradm/public_html/github2/tmp/install_503f7ef32c55c

JFolder: :folder: Path is not a folder. Path: /home/bradm/public_html/github2/tmp/install_503f7ef32c55c

JFolder: :files: Path is not a folder. Path: /home/bradm/public_html/github2/tmp/install_503f7ef32c55c

JInstaller: :Install: Cannot find Joomla XML setup file

Error
Archive does not exist

 

To change the location of your temp folder:

  1. Log into your Joomla 3.0 admin dashboard
  2. In the left menu, click the Global Configuration link
  3. At the top of the page, you will see several tabs such as Site, System, Server, etc. Click the Server tab.
  4. Next to Path to Temp Folder, enter the full path to your tmp folder and then click the Save button in the top left of the page.

    By default it will be set to (path/to/joomla)/tmp

    If the new temp folder does not exist, Joomla 3.0 will attempt to create it the next time it needs it.

Leave a Reply