Ahrens Insights

wp configphpdisabled

📅 October 29, 2026📖 Verified Publication
```html WP Config PHP Disabled: Complete Fix Guide for WordPress Errors

WP Config PHP Disabled: Complete Fix Guide for WordPress Configuration Errors

Last updated: July 2026  |  Read time: 12 minutes  |  Difficulty: Intermediate

Key Takeaways

  • A disabled wp-config.php crashes your site — WordPress cannot connect to the database or load core functionality without it.
  • Most "wp-config-php-disabled" issues stem from three causes: accidental deletion, incorrect file permissions, or a malformed code snippet inserted by a plugin or developer.
  • You can restore a missing wp-config.php by running the WordPress setup wizard or copying the sample wp-config-sample.php file and filling in your database credentials.
  • File permissions should be set to 644 for wp-config.php; 755 or higher exposes your database credentials to other users on shared hosting.
  • Security plugins like Wordfence, Sucuri, and iThemes can block wp-config.php access — check firewall rules if the file exists but returns 403 Forbidden.

What Is wp-config.php and Why Does It Matter?

wp-config.php is the backbone of every WordPress installation. Located in your site's root directory, it stores critical configuration data including database connection details, authentication keys, debug settings, and security salts. Without a functional wp-config.php, WordPress cannot boot — resulting in the well-known "Error establishing a database connection" message or a complete white screen of death.

When users and administrators search for "wp-config-php-disabled", they are typically experiencing one of the following scenarios:

  1. The file has been accidentally deleted or overwritten.
  2. Server file permissions prevent WordPress from reading the file.
  3. A security module (mod_security, Cloudflare, or a WAF) is blocking access to the file.
  4. A misconfigured PHP handler or.htaccess rule is returning a 403 Forbidden error.
  5. A plugin has inserted a conditional die() statement that disables configuration loading.

How to Diagnose a Disabled wp-config.php

Before applying any fix, you need to confirm the root cause. Follow this diagnostic checklist to pinpoint whether your wp-config.php is truly disabled, corrupted, or blocked.

Step 1 — Check File Existence via FTP or File Manager

Navigate to your WordPress root directory and look for wp-config.php. If it's missing entirely, WordPress will fail to initialize. If it exists but your site still won't load, the problem may lie in permissions or server configuration.

Step 2 — Verify File Permissions

Right-click the file in your FTP client or cPanel File Manager and check its permissions. The correct value is 644 (-rw-r--r--). If permissions are set to 000, 600, or 777, WordPress may be unable to read the file or the file may be insecure.

Step 3 — Inspect for Syntax Errors

Open wp-config.php in a code editor. Look for missing semicolons, unclosed brackets, or the die() function that some security hardening guides recommend. A single typo on line 45 can disable the entire configuration load.

Step 4 — Check Server Error Logs

Access your hosting control panel and review the PHP error log. A parse error or syntax error reference pointing to wp-config.php confirms the file is being loaded but contains invalid PHP code.

Step 5 — Test with a Clean Browser Session

Clear your browser cache and cookies, then visit your site in incognito mode. Some caching plugins or CDNs serve stale error pages that mask the real issue.

How to Fix a Disabled or Missing wp-config.php

The solution depends on which diagnostic step identified the problem. Below are the most common fixes ordered by likelihood and complexity.

Fix 1 — Restore a Deleted wp-config.php

If the file is completely gone, WordPress ships with a sample configuration file named wp-config-sample.php in the root directory. Follow these steps:

  1. Download wp-config-sample.php via FTP or duplicate it in cPanel File Manager.
  2. Rename the copy to wp-config.php.
  3. Open the file and replace the placeholder values with your actual database name, username, password, and host.
  4. Generate new authentication keys and salts from the WordPress.org secret-key service.
  5. Save the file and upload it back to the root directory.
  6. Set permissions to 644 and test your site.

Fix 2 — Correct File Permissions

Incorrect permissions are one of the most common causes of a "disabled" wp-config.php. Apply these settings:

Recommended File Permissions for WordPress Core Files
File / Directory Recommended Permission Octal Value Purpose
wp-config.php Read for owner, read-only for group and world 644 Prevents execution while allowing WordPress to read DB credentials
WordPress root directory Execute for owner, read+execute for others 755 Allows the web server to traverse the directory
wp-content directory Execute for owner, read+execute for others 755 Required for plugin and theme loading
Uploads directory Execute for owner, read+execute for others 755 Allows media files to be served
.htaccess Read for owner, read-only for group and world 644 Controls URL rewriting and access rules

To change permissions via SSH, run:

chmod 644 /path/to/your/wordpress/wp-config.php

In cPanel, select the file, click Permissions, enter 644, and click Change Permissions.

Fix 3 — Repair a Corrupted wp-config.php

If your wp-config.php exists but contains syntax errors, you have two options: