Zen Cart Logo
Forums / General Questions / Internal 500 Error - How to show the error instead?

Internal 500 Error - How to show the error instead?

Views: 1,829

Results 1 to 5 of 5
6 Nov 2015, 9:08 AM
#1
joecooper avatar

joecooper

Zen Follower

Join Date:
Aug 2011
Posts:
122
Plugin Contributions:
0

Internal 500 Error - How to show the error instead?

I have some custom code and a custom class. The class connects to an API and has error handling. This works fine with tests outside ZenCart.

The issue is, ZenCart seems to supress these errors and instead shows an Internal 500 error, instead of logging / displaying the error.

Where could I change this to show errors / at least ignore the errors?

6 Nov 2015, 3:44 PM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Internal 500 Error - How to show the error instead?

joecooper:

I have some custom code and a custom class. The class connects to an API and has error handling. This works fine with tests outside ZenCart.

The issue is, ZenCart seems to supress these errors and instead shows an Internal 500 error, instead of logging / displaying the error.

Where could I change this to show errors / at least ignore the errors?

ZC is not "handling" a 500 error, that really is coming from your server... There is something incorrect that is generating the 500 error. Information about the error should be in the server logs.
Don't know of a way other than to fix the errors to ignore them entirely... I have seen message suppression applied by prepending the offending command with @ but that's the most I've really seen/needed..

6 Nov 2015, 3:49 PM
#3
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,097
Plugin Contributions:
56

Re: Internal 500 Error - How to show the error instead?

If your code is running in a "standard" Zen Cart environment, i.e. post-application_top.php, then the error handling setup should result in debug-logs being generated for those server-500 errors (most of them, anyway). It's possible that the API you're using is somehow mucking with those PHP logging settings so that you're not getting the logs you need to correct the issue you're facing.

6 Nov 2015, 4:45 PM
#4
joecooper avatar

joecooper

Zen Follower

Join Date:
Aug 2011
Posts:
122
Plugin Contributions:
0

Re: Internal 500 Error - How to show the error instead?

The code runs fine and works outside of Zen Cart. The class I am using has exception handling so that errors will display. However, within the Zen Cart environment, these are not displaying, and zen cart seems to suppress this in terms of a 500 error. The error log doesn't show anything on the error.

7 Nov 2015, 12:49 AM
#5
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Internal 500 Error - How to show the error instead?

joecooper:

However, within the Zen Cart environment, these are not displaying, and zen cart seems to suppress this in terms of a 500 error. The error log doesn't show anything on the error.

ZenCart isn't suppressing the error messages, and the Zencart error logs won't give any info about '500' errors.

The reason is simple. The '500' errors are generally clearly indicated as being a SERVER error. This means things are 'dying' before ZenCart/PHP even gets a look in.

Server errors are distinct from PHP errors, where the server is working perfectly, but the fault is with the PHP code itself.

Knowing/understanding this is quite important. SERVER errors are generally the result of

  1. File or Folder Permissions (Too strict, or too relaxed)
  2. Mod_security rules being triggered
  3. Something amiss with the server configuration itself.

I can't offhand think of any PHP (or other) coding issue that will cause a SERVER error. Of these 3 possibilities, the only one that the user can 'fix' is the file/folder permissions. The others will need help from the hosting provider to resolve.

On the other hand, PHP and/or other coding errors are rarely ever going to be the cause a server to 'die' in such a way that the cause won't show up in the ZenCart (and/or other) error logs.

What I'm trying to impart to you here is that whatever the cause of the problem, you are not likely to find the fault with your actual code. Your best course of action would be to first check the the file/folder permissions, and if they seem ok, contact your host. They will have access to the log file that will detail exactly what and where the problem is, and they will probably even have to fix it for you when identified anyway.

If unsure about file folder permissions. Files should be '664', Folders should be '775'

There are often recommended exceptions to these values, but in my experience I don't recall ever coming across a situation or server where these values would cause a problem due to being either too relaxed or too restrictive at least from the server perspective.

If/when I come across a site with a problem that looks like it may be permissions related, those are the defaults I set to get things functional again, and then I'll tweak those that need something different by the given application.. eg: Zencart config files will need '444' (or similar)

Hope this helps put you on track.

Cheers
RodG