Excessive Debug Log Files Can Slow Down Zen Cart Admin Area

We recently ran into an issue while working on an upgrade of Zen Cart website, which seems worth sharing in case someone else runs into a similar issue.

We had first done a test of the upgrade using a copy of the website we made through FTP access and placed into a directory on the existing website. Everything worked fine with that test copy of the upgrade. Then after the production website was upgraded the client was noticing that there very long load times for pages in the admin area of Zen Cart. That wasn’t happening on the test copy and apparently that hadn’t been happening on the production website before the upgrade (though we couldn’t confirm that). Seeing as the two websites should be identical that didn’t seem to make sense.

We then stumbled in to the answer. In trying to debug things we found that over FTP we couldn’t see all of the debug log files in the /logs/ directory for the website, as there was a limit of 8,000 items being shown, which also meant the test copy only started with that many items. We couldn’t see how many files there were in the production website’s directory as in the file manager in the cPanel control panel for the website the amount of files was apparently too many for it to be able to display any files in the directory. When we temporarily replaced the /logs/ directory on the production website to be able to see the latest entries, we found that the page load time in the admin area were no longer so slow.

What looks to have been happening is that when visiting an admin page a new file was being created to warn that the setting for where to place log files of the parse time was invalid and the amount of files in the directory was slowing creating that file, leading to the slow load times. So clearing out the old debug log files would solve such a situation, but if there are lots of debug files being generated dealing with the cause of those is important as the files count will just start growing again if that isn’t dealt with.

Fixing Zen Cart Admin Login Redirect Loop Caused By Forcing Website to Be Served Over HTTPS

We recently had someone come to us for Zen Cart support after they could no longer log in to the admin area of Zen Cart after their web host configured it so their website would always be served over HTTPS. When they tried to log in they were redirected back to the log in page without any error message being shown. While there are some other issues that can cause that same type of redirect to occur, in the situation where that change to serve the website over HTTPS has been made, what we found would fix this is to update the configuration file for the admin area, which is located /includes/configure.php in side of the admin directory (whose name varies from website to website), to use the HTTPS address for the website.

The relevant portion of the configuration file for a website using a recent version of Zen Cart is below:

/**
 * Enter the domain for your Admin URL. If you have SSL, enter the correct https address in the HTTP_SERVER setting, instead of just an http address.
 */
define('HTTP_SERVER', 'http://www.example.com);
/**
 * Note about HTTPS_SERVER:
 * There is no longer an HTTPS_SERVER setting for the Admin. Instead, put your SSL URL in the HTTP_SERVER setting above.
 */

Changing the “HTTP_SERVER” setting to start https:// instead of http:// resolves this as the proper address is used when handling the log in.