Cannot Declare Class ComposerAutoLoader
We love WordPress, but the fact is that pulling data from a database just isn’t as fast as static files. A plain HTML-only site is always going to smoke a database driven site on similar hardware.
Unless you have a good caching plugin!
WP-Rocket WordPress Plugin
There are a few caching options out there to choose from. Even one by Automattic themselves.
2018 Issue: ComposerAutoLoader Error
Recently (fall of 2018) when cloning sites, we ran into an error on the new site that looked something like this:
PHP Fatal error: Cannot declare class ComposerAutoloaderInit 92972d118ced8ff642fe76cb6658cf52, because the name is already in use…
The new site would white screen and the above error was recorded in the nginx site log. Initially we thought it was something to do with the latest release of iThemes BackupBuddy, but soon realized it was the latest release of WP-Rocket v3.1.4.
If we deactivated WP-Rocket the site would load. If we tried to reactivate, the above message would show on the site dashboard.
It turns out to be an issue with the advanced-cache.php file located in the site-root/wp-content/ folder. Deleting this file caused the Cannot declare class ComposerAutoLoader error message to vanish. We didn’t need to restart nginx or anything else.
You’ll need sFTP access to get to the advanced-cache.php file. Or at the least, some type of cPanel browser access.
Simply located that file and delete it. Then refresh the site. And when cloning, remember to also toast the cache file located in the /wp-content/wp-rocket-config/ folder.
Hope that helps!