Skip to content
Tutorials Center
My learning

Topics

Lesson 9 of 37 ยท Installation and Admin

configuration.php and the Joomla Folder Structure

Learn what each Joomla folder contains, how configuration.php stores your settings, and how to review it for risky values with a runnable parser.

You can run a Joomla site for years without opening a file, but sooner or later you need to know what is where: to restore a backup, move a site to another server, fix a locked-out administrator, or review security. This lesson maps the folders of a standard installation and explains configuration.php, the one file that ties the site to its database.

The folders

After installation your site root looks roughly like this. Names are the ones in current Joomla versions (4, 5 and later).

TEXT
/
โ”œโ”€โ”€ administrator/   backend application (its own components, modules, templates)
โ”œโ”€โ”€ api/             web services (REST) application
โ”œโ”€โ”€ cache/           site cache files
โ”œโ”€โ”€ cli/             command line scripts
โ”œโ”€โ”€ components/      frontend parts of components
โ”œโ”€โ”€ images/          your uploaded images (media manager)
โ”œโ”€โ”€ includes/        bootstrap and application files
โ”œโ”€โ”€ language/        translation files for the frontend
โ”œโ”€โ”€ layouts/         shared layout files
โ”œโ”€โ”€ libraries/       Joomla framework and vendor code
โ”œโ”€โ”€ media/           CSS, JavaScript, fonts of core and extensions
โ”œโ”€โ”€ modules/         frontend module code
โ”œโ”€โ”€ plugins/         plugin code, grouped by type
โ”œโ”€โ”€ templates/       frontend templates (Cassiopeia, your own)
โ”œโ”€โ”€ tmp/             temporary files, uploads and update packages
โ”œโ”€โ”€ configuration.php
โ”œโ”€โ”€ htaccess.txt     sample Apache rules (rename to .htaccess)
โ”œโ”€โ”€ web.config.txt   sample IIS rules
โ”œโ”€โ”€ robots.txt.dist  sample robots.txt
โ””โ”€โ”€ index.php        the front controller

Which folder holds what

images/ Your media uploads
templates/ Design and overrides
components, modules, plugins Extension code
configuration.php Database and site settings

Back up images, configuration.php and the database

1 / 2

Two details matter in practice:

  • A mirrored administrator: many folders exist twice, once for the frontend and once under administrator/ (for example components/com_content and administrator/components/com_content). The first serves visitors, the second serves the backend.
  • What you back up: the database and the files that change: images/, configuration.php, installed extensions and template customizations. Core files can be reinstalled from the official package, but your content and uploads cannot.

You rarely edit files inside libraries/, administrator/, includes/ or the core extension folders. Changes there are lost on the next update. Customize through template overrides, child templates and plugins instead (chapter 5).

configuration.php

The installer writes configuration.php at the site root. It is a PHP file defining a class called JConfig with public properties. This is a shortened, anonymized example:

PHP
<?php
class JConfig {
    public $offline = false;
    public $offline_message = 'This site is down for maintenance.';
    public $sitename = 'My Joomla Site';
    public $editor = 'tinymce';
    public $list_limit = 20;
    public $access = 1;
    public $debug = false;
    public $debug_lang = false;
    public $dbtype = 'mysqli';
    public $host = 'localhost';
    public $user = 'joomla_user';
    public $password = 'example-only';
    public $db = 'joomla_local';
    public $dbprefix = 'x4k2p_';
    public $secret = 'Xy3kQ0w9AbCdEfGh';
    public $mailer = 'mail';
    public $mailfrom = '[email protected]';
    public $error_reporting = 'default';
    public $force_ssl = 0;
    public $sef = true;
    public $sef_rewrite = false;
    public $live_site = '';
    public $log_path = '/var/www/html/administrator/logs';
    public $tmp_path = '/var/www/html/tmp';
    public $session_handler = 'database';
    public $lifetime = 15;
}

Most values mirror Global Configuration settings. A few are only here:

  • $dbtype, $host, $user, $password, $db, $dbprefix: the database connection.
  • $secret: a random string used for security tokens. Keep it private; never reuse it between sites.
  • $live_site: normally empty. Set only for unusual proxy setups.
  • $log_path and $tmp_path: absolute paths that must exist and be writable. Moving a site to another server often breaks these, producing warnings until you update them.

configuration.php contains your database password. It must never be public. Do not commit it to a public code repository, and do not paste it into forum posts without removing the password and secret.

Review a configuration for risks

When you take over a site, review configuration.php first. The stand-in below parses lines of the form public $name = value; and flags values that deserve attention. It is a learning aid, not a security scanner.

JS Stand-in: review a configuration.php

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The parser uses a regular expression with named parts, then converts text values to booleans and numbers so comparisons are easy. Notice the reviewer's mindset: debug, error reporting, weak secrets, HTTPS and guessable prefixes are the first things to check.

Moving a site

A site move is a good test of your knowledge of the structure. In outline:

  1. Back up the files and export the database.
  2. Copy the files to the new server and import the database.
  3. Edit configuration.php: new database host, user, password and name, plus $log_path and $tmp_path.
  4. Make tmp/, cache/, images/ and the logs folder writable.
  5. Test the site, then flip the DNS or domain.

Tools such as Akeeba Backup (a popular third-party extension) package these steps, but understanding them helps when something goes wrong.

Common mistakes

  • Editing core files to change behavior; use overrides or plugins instead.
  • Leaving a copy such as configuration.php.bak on the server, which can be downloaded as plain text on some setups.
  • Wrong permissions: files typically 644 and folders 755; never 777.
  • Forgetting the .htaccess after copying: files starting with a dot are hidden and easily skipped.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does configuration.php contain?

    It defines the JConfig class with database details, secret, paths and settings. User passwords are stored hashed in the database.
  2. 2. Which folder holds files uploaded with the media manager?

    Uploads live in images/ by default. Include it in every backup.
  3. 3. Why should you avoid editing files in libraries/ and core extension folders?

    Core files are replaced during updates. Use overrides, child templates and plugins for customization.
  4. 4. What file permissions are a safe typical choice?

    777 allows everyone to write. 644 and 755 are the usual safe defaults on shared servers.

Summary

  • The folders separate frontend code, backend code, media, extensions, templates and temporary files.
  • Back up the database, images/, configuration.php and your customizations.
  • configuration.php defines JConfig with the database connection, secret, paths and many settings; keep it private.
  • Review it for debug mode, error reporting, weak secrets, missing HTTPS and default prefixes.
  • Customize through overrides and plugins, never by editing core files.

Next: Create and Publish Articles