In wordpress, wp-config.php contains the major information which connects a site to database.

Generally it looks like,

define('DB_NAME', 'my-database');
define('DB_USER', 'my-username');
define('DB_PASSWORD', 'my-password');
define('DB_HOST', 'localhost');

Value of DB_HOST varies from hosting company to company – though it is “localhost” most of the time.

In rare case, DB_HOST is called by $_ENV{DATABASE_SERVER}, which looks like :

This is also a trick to catch the name of Database Host automatically

To get the name of DB_HOST, simply create a .php file with any name and put the following value with php opening tag


Hope this helps!

By | Wordpress | No Comments