Skip to main content
Version: 6.1 (Upcoming)

Path Constants

Joomla sets up a number of path constants which point to various directories within the Joomla instance.

You can use these within your code if you're wanting to perform file operations on files within the directories.

These paths are the absolute paths of these locations within the file system, NOT the path you'd use in a URL; see URLs.

Several of these path constants are fixed, in that they always point to specific directories. They're generally defined in the includes/defines.php files. Note that there is no trailing slash on the directory.

Others vary depending upon the application and component which are being executed.

The fixed path constants are:

Path ConstantDescription
JPATH_ROOTRoot directory of the Joomla instance
JPATH_PUBLICRoot directory of the web-accessible section of the file system (see note 1 below)
-------------------
JPATH_SITEPath to the Joomla site - where the front-end index.php is located
JPATH_ADMINISTRATORPath to the Joomla administrator - where the administrator index.php is located
JPATH_APIPath to the api folder - where the api index.php is located
JPATH_CLIPath to the cli folder - where the joomla.php is located (which is run for console jobs)
-------------------
JPATH_CONFIGURATIONPath to the folder which contains the global config configuration.php file
JPATH_CACHEPath to the cache folder
JPATH_MANIFESTSPath to the folder where manifests are stored (by default /administrator/manifests)
JPATH_INSTALLATIONPath to the Joomla installation folder (see note 2 below)
JPATH_LIBRARIESPath to the libraries folder
JPATH_PLUGINSPath to the plugins folder
JPATH_THEMESPath to the templates folder

Notes

  1. As an example, JPATH_PUBLIC would differ from JPATH_ROOT if the Joomla instance is configured so that the files which are publicly accessible from the web (in /media, /images, etc) are below a subdirectory (eg /public) which is separated from the Joomla libraries and other code files. This is considered as more secure because code files aren't accessible via the web.

  2. The installation folder (/installation) contains the code used to install Joomla. Joomla deletes this folder after installation.

The following path constants vary depending upon the context

Path ConstantDescription
JPATH_BASERoot directory of the current application (see note 1 below)

Notes

  1. JPATH_BASE is set to be the same as JPATH_SITE / JPATH_ADMINISTRATOR / JPATH_API / JPATH_CLI, depending on which Joomla application is being executed.

  2. Joomla also currently defines JPATH_COMPONENT, JPATH_COMPONENT_ADMINISTRATOR and JPATH_COMPONENT_SITE, which point to the component folder. However these are deprecated with removal scheduled in Joomla 7, so you should avoid using them.