Post by jrr » Fri Apr 02, 2021 1:57 am

I don't see any way to differentiate between displaying errors just to admin and errors displayed to customers. I don't like all the site details that are shown when I get a PHP fatal error as someone could use that info to attempt to hack the site.

I'm assuming at this point that I need to either put a line in my .htaccess file, or php.ini but I just haven't spotted the proper code in my duckduckgo searches and testing is annoying to customers. I'd rather they just saw a white page and tried again later. What would be ideal is if the fatal error could possibly call up a special web page that said something like " Website temporarily broken, please try again soon! Email so&so@sitename.com if you really need something...". That would be cool...

Suggestions appreciated!

Thanks!

jrr
Active Member

Posts

Joined
Mon Nov 20, 2017 1:48 pm

Post by ADD Creative » Fri Apr 02, 2021 3:08 am

To stop all errors being displayed you need to do all of the following.
1. Set the PHP display_errors setting to Off (or 0 or false). This may need to be done in you main php.in, local php.ini, user.ini, .htaccess or hosting control panel, depending on you hosting setup. If you don't know where ask your host.

2. Set $_['error_display'] to false in you system/config/default.php file.

3. Set Display Errors to No in the OpenCart settings.

You would then need to look in your OpenCart error.log and the PHP error log to know of any errors.

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by jrr » Fri Apr 02, 2021 5:24 am

ADD Creative wrote:
Fri Apr 02, 2021 3:08 am
To stop all errors being displayed you need to do all of the following.
...
Yes, I have a pretty good idea how to disable displaying all errors, what I wanted to do was to turn display errors off just for the front end (customer) folks.

If that is not possible then fine, but then you are stuck with having to ftp in when you see a white screen to get an idea of what went south.

I am readinghttps://www.tutorialspoint.com/php/php_ ... ndling.htm in the hopes I can figure that out, but I'm not a coder, so still a bit of a foreign language to me when all is said and done...

Thanks!

jrr
Active Member

Posts

Joined
Mon Nov 20, 2017 1:48 pm

Post by ADD Creative » Fri Apr 02, 2021 7:32 am

Have a look here for an idea of how to change this. Although in the error handler you really only want to do that with fatal errors. https://github.com/opencart/opencart/bl ... hp#L60-L65
https://github.com/opencart/opencart/bl ... /error.php

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by jrr » Fri Apr 02, 2021 7:37 am

ADD Creative wrote:
Fri Apr 02, 2021 7:32 am
Have a look here for an idea of how to change this. Although in the error handler you really only want to do that with fatal errors. https://github.com/opencart/opencart/bl ... hp#L60-L65
https://github.com/opencart/opencart/bl ... /error.php
Yeah, fatal errors are the real pain. Too much info is let out to the customer in the form of admin directory name, dbase name etc.

I'm checking out https://www.w3schools.com/php/php_error.asp which can set up special scripts for particular errors once one figures it out enough.

Thanks!

jrr
Active Member

Posts

Joined
Mon Nov 20, 2017 1:48 pm
Who is online

Users browsing this forum: No registered users and 14 guests