A Blank Screen in Zen Cart
Your Zen Cart site is down. You have a blank screen or an error page. Well that stinks. Let's talk about what it is and how you can fix it.
A blank screen happens when your server can't build the page you're trying to load. This can happen for a number of reasons:
- A PHP Syntax error from a recent change in a file that the server is trying to run. Example:
function foo($cID) { $db->Execute("SELECT * FROM " . TABLE_CUSTOMERS . " WHERE customers_id = ". (int)$cID);
This will fail with a blank screen because you haven't done a `global $db;`. - PHP Syntax error that used to work but no longer does due to a change in PHP version by your hoster. Example: in Zen Cart 1.5.4, several
payment modules used the code
global $$order_totals[$i]['code'];
This worked in PHP 5.6 but doesn't work in PHP 7+ and will cause a blank screen. For those who are curious, the new syntax isglobal ${$order_totals[$i]['code']};
Your hoster could just update PHP without notice to you and cause this problem. - A MySQL SELECT operation that used to work but no longer does due to changes in the SELECT rules. In MySQL 5.7, by default, if you specify a column in the ORDER BY clause, that column must also be in the SELECT clause. Failing to do this will cause a blank screen. And since MySQL changes are handled by your hoster, it could just start happening one day without notice.
- A MySQL INSERT operation that used to work but no longer does due
to increased data validation. In MySQL 5.6, you could create a new
field in a table
ALTER TABLE customers ADD job_title varchar(60) NOT NULL;
and not fill in a value during the insert. In MySQL 5.7, you must provide a value, since a default for the field is not provided.
Ok Fine, but what do I do about it?
As a general rule, a blank screen cause a log file to be created. (Some instances of example 2 above will not, but generally they do.) So familiarize yourself with Zen Cart logs and see what you can do. You may be able to get help on the forum, or perhaps it will be obvious and you can fix it yourself.If the issue you are having is that your cart is incompatible with your PHP Version (example: Zen Cart 1.5.4 and PHP7, scenario 2 above), you must upgrade your Zen Cart installation. You can ask your hoster to roll you back to PHP 5.6 (or whatever version is compatible) as a temporary fix, but the real fix is upgrading.
I can't fix it myself - I need your help! What now?
You are welcome to hire me. I look at issues like this for $300. To move forward, purchase the site down product from my store. PLEASE NOTE: This may not be the final price to fix the issue.- If I can fix it with a few file changes, I will.
- If your software version is really out of date, the guidance will be to upgrade your Zen Cart, especially in cases where your cart version is no longer compatible with your PHP version (Zen Cart 1.5.4 with PHP 7, for example). You can see a compatibility matrix and other information in my Zen Cart Version page. This will involve more cost for you; you will need to buy at least a basic upgrade.
- If your problem is your hosting, the guidance will be to migrate to another hoster, if your hoster is refusing to keep things up to date. This will involve more cost for you; you will need to go on support.
If you want my help, please shoot me a quick note using my contact page and I'll let you know if I can take the job.
To buy a blank page evaluation, please purchase the purchase the site down product from my store.