WP Debug Toolkit 1.2.0 is LIVE. Get $300 discount on the lifetime deal now
Use Discount Code WPDTLTD
Get WP Debug Toolkit

When WP Debug Toolkit (WPDT) writes to wp-config.php on a host where the file is set to read-only, it automatically attempts permission elevation: WPDT stores the file’s current permission mode, uses PHP’s chmod() to make the file writable for the duration of the write, applies the change, and immediately restores the original permissions. The entire sequence runs within a single PHP request. Most sites never encounter a situation where elevation fails.

In This Guide

What Is Permission Elevation

On most hosting configurations, wp-config.php is writable by the PHP process, and WPDT writes to it directly when you toggle a debug constant from the Error Logging card at WP Debug Toolkit › Overview.

On some hosts, the file is set to read-only as a security measure. Without a way to handle this, every debug constant toggle would fail on those hosts, leaving you with a broken toggle and no clear reason why.

Permission elevation is WPDT’s automatic solution. When WPDT detects that wp-config.php is not writable, it attempts to temporarily grant write access using PHP’s chmod(), applies the constant change, and immediately restores the original permission state. 

The window during which the file is writable is as short as possible: the entire sequence runs inside a single PHP request, and WPDT restores the original mode whether the write succeeds or fails.

How It Works

WPDT runs the following four-step sequence whenever it detects that wp-config.php is not writable:

  1. Read current permissions. WPDT stores the file’s current permission mode before making any change (e.g., 0444).
  2. Elevate. WPDT uses PHP’s chmod() to change the file to a writable mode (e.g., 0644) for the duration of the write operation.
  3. Write. WPDT applies the debug constant changes to wp-config.php.
  4. Restore. WPDT sets the file back to its original permission mode (e.g., 0444).

The file is writable only for the duration of the write operation. WPDT always restores the original permissions, regardless of whether the write succeeded or failed.

When elevation works: WPDT’s chmod() call succeeds when the PHP process owns the file or has sufficient filesystem access. This covers most shared hosting, VPS, and dedicated server environments where the web server user owns the WordPress files.

When elevation fails: Three conditions prevent elevation from succeeding. 

  • First, when wp-config.php is owned by a different system user: chmod() requires file ownership or root privileges. 
  • Second, when the hosting platform enforces a lockdown at the platform level. Flywheel is an example here. This is not a permissions issue that chmod() can solve, regardless of what the file’s permissions appear to show. 
  • Third, when server-level security modules such as SELinux or AppArmor block the chmod() call even when the PHP user owns the file. When elevation fails, the toggle does not hard-fail. WPDT instead saves your selection to the WordPress database and shows a warning instead. The constant itself is not written to wp-config.php, so the underlying debug behavior does not change until you resolve the permission issue or use the manual fallback below.

Step-by-Step: Check Config Permissions in Site Health

Step 1: Navigate to Site’s Health

Go to WP Debug Toolkit › Site’s Health. The Config Permissions card loads automatically and reports the current writability status of your config file.

wp-debug-toolkit-config-permissions

Step 2: Read the Card Result

WPDT runs the elevation test as part of loading the page. If wp-config.php is not directly writable, WPDT attempts a chmod() test, checks the result, and immediately restores the original permissions. No content is written to the file.

A Config OK badge confirms that WPDT can write to the config file, either directly or via elevation. 

A Config Not Writable badge means elevation failed and the debug constant toggles will not work until you resolve the permission issue or use the manual fallback below.

To refresh the results at any time, click Run Health Check at the top of the page.

What You Should See: A Config OK badge on the Config Permissions card confirms that the debug constant toggles in the Error Logging card at WP Debug Toolkit › Overview will apply successfully.

Hosting Compatibility

HostPermission ElevationNotesRecommendation
Most shared hostingWorksPHP typically owns WordPress files.No action needed. Elevation succeeds automatically.
VPS / dedicatedWorksStandard ownership model.No action needed. Elevation succeeds automatically.
GridPaneWorks the same as standard hostsWPDT writes constants to wp-config.php on GridPane, the same as on any other host. Elevation logic applies normally and succeeds as long as GridPane’s wp-config.php is writable by the PHP process, which it is on standard installs.No action needed in most cases. If your GridPane wp-config.php shows restrictive permissions, check Site’s Health like you would on any other host.
FlywheelElevation fails silentlyThe toggle appears to save successfully in the admin UI, but a platform-level lockdown prevents the write from reaching wp-config.php. The constant change does not take effect. Use Flywheel’s built-in debug toggle, then use WPDT normally for log viewing and monitoring.

Common Issues and How to Fix Them

Toggle Switches Show a Warning That wp-config.php Was Not Writable

Likely cause: WPDT attempted permission elevation and it failed. The file is owned by a different system user, the hosting platform blocks modifications at the platform level, or a server security module is blocking chmod(). WPDT saves your selection to the database, but the constant is not written to wp-config.php, so the debug behavior itself does not change.

Fix: Navigate to WP Debug Toolkit › Site’s Health and check the Config Permissions card. A Config Not Writable badge confirms which failure condition applies. If the platform blocks modifications entirely, as Flywheel does, use the manual fallback described below.

If you toggle debugging with WP-CLI’s wp dbtk debug on instead of the admin UI, a failed write returns “Failed to enable debugging. Check wp-config.php permissions.” directly in the terminal. This message is specific to the CLI command and does not appear in the WP Debug Toolkit admin interface.

Config Permissions Card Shows “Config OK” But Debug Constants Toggles Still Fail

Likely cause: A caching layer is interfering between the health check and the actual write attempt, or a different security mechanism is active only during live write operations rather than during the health check’s chmod() test.

Fix: Use the manual fallback via SFTP described below, then re-enable all other WPDT features normally once the constants are in place.

Manual Fallback

This fallback applies to permission-based lockouts, such as a wp-config.php owned by a different system user or blocked by a security module. It will not work on Flywheel, where the lockout is platform-level rather than permissions-level. Use Flywheel’s built-in debug toggle instead.

If permission elevation fails and your hosting dashboard does not offer a debug toggle:

  1. Connect via SFTP.
  2. Download wp-config.php.
  3. Add or edit the following constants:
php
define( 'WP_DEBUG', true );        // Enables WordPress debug mode
define( 'WP_DEBUG_LOG', true );    // Writes errors to the log file
define( 'WP_DEBUG_DISPLAY', false ); // Keeps errors off the public-facing site
  1. Upload the file.

After enabling debug logging manually, all other WPDT features that depend on log output work normally. The Error Log Viewer reads from the log file regardless of how WP_DEBUG_LOG was enabled. The manual fallback is only needed for the initial wp-config.php write on restricted hosts. Once the constants are in place, WPDT reads from them directly.

Permission Elevation — Frequently Asked Questions

Does Permission Elevation Work on Flywheel?

No. Flywheel enforces a platform-level lockdown that prevents wp-config.php modifications regardless of file permissions. This is not a chmod() problem that WPDT can work around. To resolve it, use Flywheel’s built-in WordPress debug toggle to enable WP_DEBUG and WP_DEBUG_LOG, then use WPDT normally for viewing logs, monitoring queries, and receiving email alerts.

How Long Does wp-config.php Remain Writable During Elevation?

Only for the duration of the write operation within a single PHP request. WPDT stores the original permission mode at the start of the process and restores it immediately after writing, or immediately after a failure. There is no window where the file stays writable after the operation completes.

What Happens If I Enable WP_DEBUG_LOG Manually via SFTP Rather Than Through WPDT’s Toggles?

All WPDT features that depend on logging continue to work normally. The Error Log Viewer reads from the log file regardless of how WP_DEBUG_LOG was enabled. Permission elevation is only needed for the initial write. Once the constants are in wp-config.php, WPDT reads from them directly.

Related Documentation

How to Automatically Enable WordPress Debug Mode – Learn more about the constants WPDT manages with its toggle switches.

How to Safely Modify wp-config.php – Learn how WPDT protects your wp-config.php during every write operation, including what happens when a write fails.

Flywheel compatibility – Running on Flywheel? Here’s how to get WP_DEBUG enabled and WPDT working correctly on that platform.

On this page
Try WP Debug Toolkit
The best error log viewer with amazing developer tools to help you troubleshoot your WordPress site securely and efficiently. Something something more.