4.1.4 Where are the configuration files for different CMS. How to connect a database to your site

Main banner When working with websites, especially those using popular content management systems (CMS), configuration files play an important role. These files contain a number of important settings that determine the behavior and functionality of your site. In this article, we will look at how to find the configuration file and how to change the database access settings in it.

Editing configuration files

You can edit configuration files in any text editor if you work with files via FTP or directly in panel hosting management ISPmanager, in the section Tools - File manager. After that, go to the file manager using the path given below and find the file you want. Then double-click to open it or select the file and click the Edit button at the top.

Go to the site configuration file

Sometimes you need to write the correct paths to your site or some folders. We will demonstrate using the example of the Joomla CMS configuration file:

Folder path

Note: the full path to your site will look like this
The template by which the path from the root of the server is formed
/var/www/user_name/data/www/your_site_name/
Example of a finished path:
/var/www/user_login/data/www/joomla.theweb.place/

WordPress

The site configuration file is placed in the following way:

  • ~/www/site_name/wp-config.php

Below is an example of a part of the configuration file, in which the database access parameters are specified:

~/www/site_name/wp-config.php
...
define('DB_NAME', 'DATABASE NAME');
define('DB_USER', 'DATABASE USER NAME');
define('DB_PASSWORD', 'PASSWORD');
...

OpenCart

The site configuration file is placed in the following way:

  • ~/www/site_name/config.php

Файл конфігурації адмін-панелі:

  • ~/www/site_name/admin/config.php

Below is an example of a part of the configuration file, in which the database access parameters are specified:

~/www/site_name/config.php
...
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'DATABASE USER NAME');
define('DB_PASSWORD', 'PASSWORD');
define('DB_DATABASE', 'DATABASE NAME');
...

MODx

The site configuration file is placed in the following way:

  • ~/www/site_name/core/config/config.inc.php

Below is an example of a part of the configuration file, in which the database access parameters are specified:

~/www/site_name/core/config/config.inc.php
...
$database_server = 'localhost';
$database_user = 'DATABASE USER NAME';
$database_password = 'PASSWORD';
$dbase = 'DATABASE NAME';
$database_dsn = 'mysql:host=localhost;dbname=DATABASE NAME;
...

Bitrix

The site configuration file is placed in the following way:

  • ~/www/site_name/config.local.php

Below is an example of a part of the configuration file, in which the database access parameters are specified:

~/www/site_name/config.local.php
...
'connections' => array (
		'value' => array (
		'default' => array (
		'className' => '\\Bitrix\\Main\\DB\\MysqlConnection',
		'host' => 'localhost',
		'database' => 'DATABASE NAME',    
		'login' => 'DATABASE USER NAME',
		'password' => 'PASSWORD',
		'options' => 2,
...

Joomla

The site configuration file is placed in the following way:

  • ~/www/site_name/configuration.php

Below is an example of a part of the configuration file, in which the database access parameters are specified:

~/www/site_name/configuration.php
...
var $user = 'DATABASE USER NAME';
var $db = 'DATABASE NAME';
var $password = 'PASSWORD';
...

Drupal

The site configuration file is placed in the following way:

  • ~/www/site_name/sites/default/settings.php

Below is an example of a part of the configuration file, in which the database access parameters are specified:

~/www/site_name/sites/default/settings.php
...
$databases = array (
  'default' =>
  array (
    'default' =>
    array (
		'database' => 'DATABASE NAME',
		'username' => 'DATABASE USER NAME',
		'password' => 'PASSWORD',
		'host' => 'localhost',
		'port' => '',
		'driver' => 'mysql',
		'prefix' => '',
    ),
  ),
);
...

Simpla

The site configuration file is placed in the following way:

  • ~/www/site_name/config/config.php

Below is an example of a part of the configuration file, in which the database access parameters are specified:

~/www/site_name/config/config.php
...
$config['dbms'] = 'mysqli';
$config['db_hostname'] = 'localhost';
$config['db_username'] = 'DATABASE USER NAME';
$config['db_password'] = 'PASSWORD';
$config['db_name'] = 'DATABASE NAME';
$config['db_prefix'] = 'cms_';
$config['timezone'] = 'UTC';
...

PrestaShop

The site configuration file is placed in the following way:

  • ~/www/site_name/config/settings.inc.php

Below is an example of a part of the configuration file, in which the database access parameters are specified:

~/www/site_name/config/settings.inc.php
...
define('_DB_NAME_', 'DATABASE NAME');
define('_DB_USER_', 'DATABASE USER NAME');
define('_DB_PASSWD_', 'PASSWORD');
...

DLE

The site configuration file is placed in the following way:

  • ~/www/site_name/engine/data/dbconfig.php

Below is an example of a part of the configuration file, in which the database access parameters are specified:

~/www/site_name/engine/data/dbconfig.php
...
define ("DBNAME", "DATABASE NAME");
define ("DBUSER", "DATABASE USER NAME");
define ("DBPASS", "PASSWORD");
...

Magento

The site configuration file is placed in the following way:

  • ~/www/site_name/app/etc/local.xml

Below is an example of a part of the configuration file, in which the database access parameters are specified:

~/www/site_name/app/etc/local.xml
...
<host><![CDATA[localhost] ]></host>
<username><![CDATA[DATABASE USER NAME] ]></username>
<password><![CDATA[PASSWORD] ]></password>
<dbname><![CDATA[DATABASE NAME] ]></dbname>
...

Shop-script

The site configuration file is placed in the following way:

  • ~/www/site_name/cfg/connect.inc.php

Below is an example of a part of the configuration file, in which the database access parameters are specified:

~/www/site_name/cfg/connect.inc.php
...
define('DB_HOST', 'localhost');
define('DB_USER', 'DATABASE USER NAME');
define('DB_PASS', 'PASSWORD');
define('DB_NAME', 'DATABASE NAME');
...

ShopCMS

The site configuration file is placed in the following way:

  • ~/www/site_name/core/config/connect.inc.php

Below is an example of a part of the configuration file, in which the database access parameters are specified:

~/www/site_name/core/config/connect.inc.php
...
define('DB_HOST', 'localhost');
define('DB_USER', 'DATABASE USER NAME');
define('DB_PASS', 'PASSWORD');
define('DB_NAME', 'DATABASE NAME');
...

phpBB

The site configuration file is placed in the following way:

  • ~/www/site_name/config.php

Below is an example of a part of the configuration file, in which the database access parameters are specified:

~/www/site_name/config.php
...
$db_type = 'mysql';
$db_host = 'localhost';
$db_name = "$DATABASE NAME";
$db_username = '$DATABASE USER NAME';
$db_password = '$PASSWORD';
$db_prefix = '';
...

vBulletin

The site configuration file is placed in the following way:

  • ~/www/site_name/includes/config.php

Below is an example of a part of the configuration file, in which the database access parameters are specified:

~/www/site_name/includes/config.php
...
$config['SlaveServer']['servername'] = 'localhost';
$config['SlaveServer']['port'] = 3306;
$config['SlaveServer']['username'] = 'DATABASE USER NAME';
$config['SlaveServer']['password'] = 'PASSWORD';
$config['SlaveServer']['usepconnect'] = 0;
...