If you look in your file manager at your Joomla files, you'll see in the base folder a file called configuration.php. Get to know it. It's the key to your Joomla site.

Joomla's configuration.php File

Joomla configuration.phpThe Joomla config file is a very important file and contains data that orients your Joomla website. Some examples of what is in the config file:

  • The database username, id and password.
  • The database host address.
  • The site name and site meta description.
  • And of course, a lot more.

Why the Config File is the Source of So Many Errors

The configuration.php file is often the source of errors for beginner Joomla users when you first move or set up your site. So if you have just moved your site and have installed the database and uploaded all the files of the site, including the configuration file then you will find the site won't work. This is a classic mistake for beginners. And it's all because of the config file.

The configuration.php file is specific to where your site is - a.k.a. the host. It contains the information that directs your Joomla site to the correct database, gives it the correct database password and database host address, so that if you upload your local site (http://localhost/yoursite) to your live host (http://www.yoursite.com) with the config file that has all the information specific to the local host and related database (a.k.a. your computer) then the live site will try connecting to that database and will only show you an error message.

How to Avoid Joomla Configuration Related Errors

If you have an error because of the configuration.php file, your browser may show you an error like this:

  • Database connection error (2): Could not connect to MySQL.
  • Database connection error (3): Could not connect to database
  • Table 'database.prefix_session' doesn't exist SQL=INSERT INTO `prefix_session` (`session_id`, `client_id`, `time`) VALUES ('random-numbers-and-letters', 0, 'random-numbers')

To avoid these error, either go and edit that configuration file on the live site and adjust the information to reflect that your site is now pointing to a different host and database. Commonly, the issues are with these data:

  • public $host = 'your live host address';
  • public $user = 'php database username';
  • public $password = 'php database password';
  • public $db = 'php database id';
  • public $dbprefix = 'your database prefix (if you look at your database in phpMyAdmin, it's the letters and number followed by and including the underscore)';

But also ensure these are also correct:

  • public $log_path = '/home/your C-Panel username/public_html/the folder holding your site files/logs';
  • public $tmp_path = '/home/your C-Panel username/public_html/the folder holding your site files/tmp';

One of the easiest ways to avoid these errors is to install Joomla from scratch at the same time on your local and your live host. After you have worked on your site locally (the site you have on your computer, perhaps with winampp) upload your database file to the live database and you should see all the changes to content appear on the live site. If you have added modules, components or plugins or made any changes to your template files you will need to upload the site files too. Just be sure you do not upload the configuration.php file as this will overwrite the config file on the live site and show the errors described above.