Eric

Zen Cart Cache Overflowing? Here’s a fix…

Est. Reading Time: 3 minutes

A popular CMS system for e-commerce sites, Zen Cart offers advantages in an easy-to-use admin interface (especially for novices) and extensive customization capabilities for developers, either through the out-of-the-box modules or through custom added code added directly to the server.

However, one issue I have found with extensive customization is that some changes may have the unintended consequence of causing the cache folder – typically located on the server at /site/cache/ – to slowly (but without warning) build to an extremely large size that could crash the website.  This occurs because certain changes may trigger a debugging file to kick in and write error reports to the cache folder every minute.  This could lead to over a gig of information, or twice that if you are also running a test site, being generated by the site in a matter of weeks.

These files are generated by a debugging file that should be located at /site/includes/extra_configures/enable_error_logging.php.

Most of the recommendations I encountered for dealing with this issue involved just removing the enable_error_logging file altogether.  However, while this did stop writing files to the cache folder and preventing the folder from overflowing, it actually led to a queer circumstance where the errors were still written…only directly to the site itself, leading to some very strange display situations on select browsers.

As such, I recommend not deleting this file.  The best fix I was able to manage was to leave the file in existence, but alter its functionality.  This was accomplished by the following steps:

1) Open /site/includes/extra_configures/enable_error_logging.php.  Save a copy locally or with a different file extension within the same folder.  You will still want the code contained to be in existence should you ever want to debug select customizations or module installations using this file.

2) Look at the section that includes the snippets stated $pages_to_debug[] .  Delete all but one of these items (leaving one snippet that states $pages_to_debug[] = ‘ ‘;).  This should be in the vicinity of lines 18-20.

3)From here, delete all lines between the aforementioned line of code and the comment that states ///// DO NOT EDIT BELOW THIS LINE /////.  This should be located between lines 35 & 40.

That’s it!  Enough of the file is still in existence to prevent any errors from crashing your site, but the writing functionality to the cache folder has been removed, preventing any worries of unwanted gigs of data being accumulated.  Should you need to debug the site at a future date, simply go to the copied folder and replace the removed lines.  When you are done, delete the lines again as indicated.

- EW

Follow me on twitter: @ejwestksu