WordPress reads this file before anything else on every request, so one small mistake, like a missing semicolon, can take the whole site down. It’s also one of the most sensitive files you have, because it contains the database password.
What’s inside
define( 'DB_NAME', 'user_wpdb' );
define( 'DB_USER', 'user_wpuser' );
define( 'DB_PASSWORD', 'strong-password-here' );
define( 'DB_HOST', 'localhost' );
define( 'DB_CHARSET', 'utf8mb4' );
$table_prefix = 'wp_';
define( 'WP_DEBUG', false );
The file also holds eight security keys and salts, such as AUTH_KEY, which protect login cookies. Changing them logs every user out, which is useful after a suspected break-in.
Useful constants
| Constant | Use |
|---|---|
WP_DEBUG / WP_DEBUG_LOG |
Log errors to wp-content/debug.log |
WP_MEMORY_LIMIT |
Raise the memory available to WordPress |
DISALLOW_FILE_EDIT |
Block theme and plugin file editing from the dashboard |
DISABLE_WP_CRON |
Turn off WP-Cron and use a real cron job |
WP_HOME / WP_SITEURL |
Force the site URL after a move or domain change |
FORCE_SSL_ADMIN |
Force the dashboard onto HTTPS |
Add any new constant above the line /* That's all, stop editing! Happy publishing. */, or it may not take effect. If you disable WP-Cron without adding a replacement job, scheduled tasks stop; see WordPress cron not working.
Common problems
Error establishing a database connection: the credentials in the file don’t match the real database, often after a migration. See fixing this error.- White screen after an edit: a PHP syntax error; compare your change with the previous version.
- Loose permissions: don’t leave the file world-readable.
600or640usually works; see file permissions or work it out with the chmod calculator.
On ArabyHost
The one-click WordPress install creates the file for you with the correct database details. You edit it in cPanel’s File Manager, which opens with one click from the Araby Panel; on cPanel servers DB_HOST is normally localhost. Every account is isolated with CageFS, so other accounts can’t read your files. If an edit breaks the site, restore the file from the daily backups, or ask the Araby AI assistant to read the error log and explain what went wrong. For Arabic in the database, see utf8mb4.
FAQ
Where do I find wp-config.php?
In the folder where WordPress is installed, next to wp-admin and wp-content; for the main site that's usually public_html. Open it in cPanel's File Manager and click Edit.
Can I delete wp-config.php?
No. Without it WordPress doesn't know how to reach the database and shows the install screen again. If the file is damaged, restore it from a backup or rebuild it from wp-config-sample.php.
How do I use wp-config to find the cause of a white screen?
Turn on WP_DEBUG and WP_DEBUG_LOG with WP_DEBUG_DISPLAY off, so errors are written to wp-content/debug.log without being shown to visitors. Set WP_DEBUG back to false once it's fixed.