# Fix WP Super Cache “Unable to Update wp-config.php”
When you install the WP Super Cache plugin and it cannot write to your `wp-config.php`, WordPress typically surfaces a message such as “Unable to update wp-config.php.” The error usually appears during activation, when the plugin tries to add the `WP_CACHE` constant and point WordPress at its drop-in cache loader. On most self-hosted setups the cause is a file-permission or ownership mismatch — the web server process simply lacks write access to the WordPress root — rather than a defect in the plugin itself.
This guide walks through a manual fix that works whether or not the automatic write succeeds. You will verify the two drop-in files WP Super Cache relies on, then add the required constants to `wp-config.php` by hand. The steps assume a typical Linux/Apache or Linux/Nginx install where WordPress lives under a path like `/var/www/html/wordpress/`.
## Before you start: a quick safety checklist
Technical tutorials fail most often when commands are copied without accounting for differences in environment. Before touching any configuration file, confirm the following:
– **WordPress path.** Your install may not live at `/var/www/html/wordpress/`. Adjust every path below to match your real document root.
– **Web server user.** On Debian/Ubuntu this is usually `www-data`; on CentOS/RHEL it is often `apache` or `nginx`. WP Super Cache needs write access to `wp-content/` as this user.
– **Permissions.** Directories are commonly `755`, files `644`, and `wp-config.php` often `640` or `644`. Overly permissive settings are a security risk; overly restrictive settings cause exactly the error you are debugging.
– **Backup.** Copy `wp-config.php` and back up your database before making changes. If a step goes wrong, you can restore in seconds.
– **Test one change at a time.** Verify after each edit so you can isolate the cause if something breaks.
## Why the error happens
During activation, WP Super Cache attempts three things:
1. Copy `wp-cache-config-sample.php` from the plugin folder into `wp-content/wp-cache-config.php`.
2. Copy `advanced-cache.php` from the plugin folder into `wp-content/advanced-cache.php`.
3. Insert two `define()` lines into `wp-config.php`, ahead of the line that reads `/* That’s all, stop editing! */` (or ahead of `ABSPATH`).
If the web server cannot write to `wp-config.php`, step 3 fails and you see the “Unable to update wp-config.php” message. Steps 1 and 2 may also have failed silently, leaving the cache half-configured. The fix below completes all three steps manually so the plugin can start cleanly.
## Step 1: Check the cache drop-in files
Open a shell on your server and navigate to the `wp-content` directory:
“`bash
cd /var/www/html/wordpress/wp-content
“`
Check whether `wp-cache-config.php` exists. If it does not, create it by copying the sample file bundled with the plugin:
“`bash
cp plugins/wp-super-cache/wp-cache-config-sample.php ./wp-cache-config.php
“`
Next, check for `advanced-cache.php` in the same directory. If it is missing, copy the plugin’s version into place:
“`bash
cp plugins/wp-super-cache/advanced-cache.php ./
“`
These two files are what WordPress loads as “drop-ins” when caching is enabled. Without them, enabling `WP_CACHE` will produce a different error at the top of the admin screen. If both files already exist, leave them in place and move on.
## Step 2: Add the constants to wp-config.php manually
Return to your WordPress root directory and open `wp-config.php` in a text editor:
“`bash
cd /var/www/html/wordpress
nano wp-config.php
“`
Find the line that defines `ABSPATH`, or the comment that says `/* That’s all, stop editing! */`, and insert the following two lines **above** it:
“`php
define(‘WP_CACHE’, true);
define(‘WPCACHEHOME’, ‘/var/www/html/wordpress/wp-content/plugins/wp-super-cache/’);
“`
Replace the `WPCACHEHOME` path with the absolute path to the WP Super Cache plugin folder on your server. The trailing slash is required.
Save the file and exit. Because you edited `wp-config.php` as a user with shell access rather than as the web server process, the permission problem that blocked the automatic write no longer matters — the constants are already in place.
## Step 3: Reload the admin and verify
Reload the WordPress dashboard and open **Settings → WP Super Cache**. The “Unable to update wp-config.php” notice should be gone, and the plugin should report that caching is enabled. If it does not, re-check three things:
– The `WP_CACHE` line sits **before** the `ABSPATH` definition, not after it.
– The `WPCACHEHOME` path points to the real plugin directory (watch for typos and missing trailing slashes).
– The two drop-in files exist in `wp-content/` and are readable by the web server user.
## Step 4: Make the fix stick across updates
To stop the error from reappearing after a plugin update or a server reboot, ensure the web server user owns the files it needs to write:
“`bash
chown -R www-data:www-data /var/www/html/wordpress/wp-content
chmod 755 /var/www/html/wordpress/wp-content
“`
Use the correct username for your distribution (`apache`, `nginx`, etc.). Avoid setting `wp-config.php` world-writable (`777` or `666`) — those permissions are insecure and most hosting providers will flag them.
## Common follow-on issues
– **”Warning! WP_CACHE is not enabled”** still appears. You placed the `define()` lines after `ABSPATH` instead of before it. Move them higher in the file.
– **Page serves a blank screen.** A PHP syntax error was introduced during editing. Restore `wp-config.php` from your backup and re-apply the two lines carefully, including the semicolons.
– **Cache files do not generate.** Confirm `wp-content/cache/` exists and is writable by the web server. WP Super Cache creates this directory automatically when permissions are correct.
– **Path mismatch after migration.** If you moved WordPress to a new server, the hardcoded `WPCACHEHOME` value is now wrong. Update it to the new absolute path.
## Long-term maintenance notes
Fixing the error once does not guarantee it stays fixed. Keep a short record of the files you changed (`wp-config.php`, the two drop-ins), the commands used, and the timestamp. When you later migrate servers, update WordPress core, or switch themes, this log will save significant troubleshooting time. Re-run the plugin’s built-in “Easy” setup after any major change to confirm caching still works end to end.
## Risk and freshness notice
WP Super Cache and WordPress core are actively maintained. Menu labels, default paths, file names, and activation behavior can change between versions. The paths shown here reflect a typical self-hosted install; verify them against your own server before running commands. If you are on managed WordPress hosting, your provider may restrict direct file edits — in that case, contact support or use the host’s file manager to apply the same changes.
## Conclusion
The “Unable to update wp-config.php” error from WP Super Cache is almost always a file-permission issue, not a broken plugin. By manually copying the two drop-in files into `wp-content/`, adding the `WP_CACHE` and `WPCACHEHOME` constants ahead of `ABSPATH`, and confirming ownership of the writable directories, you complete the same configuration the plugin would have written automatically. Take a backup first, change one thing at a time, and verify in the admin after each step — that disciplined approach resolves this error and prevents it from recurring.










