Solved: W3 Total Cache 500 Error When Updating Posts/Pages/Options
In A Nutshell
Problem: WordPress website experiences a 500 internal server error when you try and update a post, flush the cache or edit options.
Cause: A specific (new) setting in W3 Total Cache, meant for Premium users, is automatically checked and cannot be undone.
Solution: Change the setting manually by editing the plugin files, or roll back to a previous version.
Finding The Bug
A client emailed me today saying she was getting 500 internal server errors every time she tried to update her posts. On further inspection, the bug also occurred when:
- New posts or pages were published
- WordPress options were updated
- The cache was flushed
My instinct was that this was a Yoast issue: I’ve seen this bug occur in the past and with hiccups surrounding the 7.0 release, maybe that error had returned. In this instance, the problem was with another plugin.
So what’s the cause of the error? If these same symptoms occur on your website, check the debug log. You might see something along these lines:
#0 /var/sites/public_html/wp-content/plugins/w3-total-cache/Cdnfsd_CacheFlush.php(222): W3TC\Cdnfsd_Core->get_engine() #1 [internal function]: W3TC\Cdnfsd_CacheFlush::w3tc_flush_execute_delayed_operations(Array) #2 /var/sites/public_html/wp-includes/class-wp-hook.php(286): call_user_func_array(Array, Array) #3 /var/sites/public_html/wp-includes/plugin.php(203): WP_Hook->apply_filters(Array, Array) #4 /var/sites/public_html/wp-content/plugins/w3-total-cache/CacheFlush_Locally.php(253): apply_filters('w3tc_flush_exec...', Array) #5 /var/sites/public_html/wp-content/plugins/w3-total-cache/CacheFlush.php(188): W3TC\CacheFlush_Locally->execute_delayed_operations() #6 /var/sites/public_html/wp-content/plugins/w3-total-cache/CacheFlush.php(1 in /var/site/public_html/wp-content/plugins/w3-total-cache/Cdnfsd_Core.php on line 48
Or, you might see an error message like this in WordPress:
"Uncaught exception 'Exception' with message 'unknown engine" ... etc etc
The giveaway is CDN FSD. This means “Full Site Delivery” and it’s a new feature released in W3 Total Cache 0.9.6. Apparently, it allows the whole site to load “instantly” and is only available for Premium users. Whether or not that claim is true, the FSD option is activated by default, even to free accounts. What’s more, it cannot be deactivated through the dashboard. Suspicious.
Undoing The Damage
Logic dictates that if this dubious, Premium option is highlighted in the error log, we should probably undo it and see what happens.
- Through File Manager/cPanel/FTP, navigate to wp-content/w3tc-config/master.php.
- Search for our friend cdnfsd. You should see it along with these lines:
“cdnfsd.enabled”: “1”, “cdnfsd.engine”: “”, “cdnfsd.debug”: false,
- Change the “1” to “0”, thus disabling the CDN FSD option. So it should be:
“cdnfsd.enabled”: “0”, “cdnfsd.engine”: “”, “cdnfsd.debug”: false,
- Save the file and exit.
Now go back into WordPress and try updating a post. If the 500 error disappears, it looks like the problem has been solved.
Alternative Method: Roll Back
By all accounts W3TC is a fantastic plugin; blips like this are frustrating, but rare. If this issue is getting in the way, simply switch back to the previous version until the plugin authors fix it. You can do so by using a Rollback plugin, or by deleting W3 Total Cache altogether and reinstalling version 0.9.5.4 from scratch. Just be careful that you follow the proper procedure as it can be a little fiddly to wipe off the server.
Needless to say, there are a number of factors that cause these kind of errors; this tutorial covers one specific issue. For a broader look at 500 Server Errors with W3TC, I’d point you to this excellent article from WP Beginner. Good luck!