Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Understand the wp-config.php File

This guide explains what wp-config.php does, what is inside it, and how to edit it safely.

Getting Started2 min read8 steps3 screenshots

What is wp-config.php?

WordPress is software for building websites. The file wp-config.php is its main settings file. It tells WordPress how to connect to its database. A database is the place where your posts, pages and users are stored.

Screenshot: WordPress is software for building websites. The file wp-config.php is its main settings f

It lives in the main folder of your WordPress site, often called public_html.

Warning: A mistake in this file can break your whole site. Always download a copy first as a backup.

What is inside

  • DB_NAME: the name of your database.
  • DB_USER: the database username.
  • DB_PASSWORD: the database password.
  • DB_HOST: where the database lives. Often it is localhost, which means the same server.
  • Security keys: long random text that helps protect logins.
  • $table_prefix: the start of each table name in the database.
  • WP_DEBUG: a switch that shows errors when set to true.

Steps to edit it

  1. Log in to your control panel.
    Screenshot: Log in to your control panel.
  2. Open File Manager.
  3. Go to your site's main folder, such as public_html.
  4. Right-click wp-config.php and choose Download to save a backup copy.
  5. Right-click it again and choose Edit.
  6. Make your change above the line that says "That's all, stop editing!".
  7. Click Save Changes.
  8. Open your site and check that it still loads.

Useful settings

Turn on error messages while you fix a problem:

define( 'WP_DEBUG', true );

Set it back to false when you are done.

Give WordPress more memory:

define( 'WP_MEMORY_LIMIT', '256M' );

Stop the built-in file editor in the dashboard:

define( 'DISALLOW_FILE_EDIT', true );

Keep it safe

  • Never share this file. It holds your database password.
  • Do not paste its contents in public forums.
  • If you change the database password in your control panel, update DB_PASSWORD here too.

Need help? Open a support ticket.

Quick recap

  • wp-config.php holds your WordPress database details and key settings.
    Screenshot: wp-config.php holds your WordPress database details and key settings.
  • It sits in your site's main folder.
  • Download a backup before editing.
  • Edit above the "stop editing" line.
  • Keep the file private.