View Categories

Glossary: The wp-config.php File

2 min read

What wp-config.php is #

The wp-config.php file is the configuration file for your WordPress installation. It lives in the root directory of your site (the same folder where you’d find wp-login.php). WordPress reads it on every page load before doing anything else. If this file is missing, has wrong information, or contains a syntax error, your site won’t load.

The file is created automatically when you install WordPress. You enter your database details during installation, and WordPress writes them into wp-config.php. You rarely need to touch it after that, but several important situations require editing it: troubleshooting Database Connection errors, enabling debug mode, increasing the PHP Memory Limit, or recovering from a login redirect loop.

What it contains #

The most critical section is the database credentials: the database name (DB_NAME), the database username (DB_USER), the database password (DB_PASSWORD), and the database host (DB_HOST, usually localhost). If any of these are wrong, WordPress can’t connect to the database and the site goes down with the “Error establishing a Database Connection” message.

Beyond the database credentials, wp-config.php contains: security keys and salts (long random strings that WordPress uses to encrypt login cookies), the database table prefix (the characters before your table names, typically wp_), and any constants you’ve added manually for debugging or performance.

Constants you may encounter or add #

WP_DEBUG: Set to true to enable error display. Never leave this enabled on a live site, as it can reveal server details to visitors. WP_DEBUG_LOG: When combined with WP_DEBUG, writes errors to a debug.log file instead of displaying them on screen. Safer for live environments. WP_MEMORY_LIMIT: Increases the PHP Memory Limit available to WordPress scripts. WP_HOME and WP_SITEURL: Override the WordPress URL settings from the database. Useful for breaking redirect loops caused by URL mismatches.

Why this file appears in Loupely’s context #

Several Loupely troubleshooting articles reference editing wp-config.php: adding WP_MEMORY_LIMIT to fix memory exhaustion errors, adding WP_HOME and WP_SITEURL to fix HTTPS redirect loops, and adding the database repair constant to fix corrupted database tables. In each case, the edit is a single line added above the “That’s all, stop editing!” comment near the bottom of the file.