Replace white screen in case of error

Hey,

I am doing a lot of tests with ExeOutput and I love the product! :slight_smile:
I just encountered one problem which I would like to solve.
In case of a PHP error (typo, missing semicolon, coding error) I just get a blank white screen.
With having php logging enabled I can easy find the root cause and fix it but a blank website is not really user friendly.
Would it be possible to just style this blank website by myself with a message “whops something went wrong - please restart the tool” or do some PHP actions to redirect the user to a side which works for 100% to get the tool working again?

That would be a bit more userfriendly instead of showing a white screen in case of an error :slight_smile:

How to reproduce:
create a php file with the following content and then let it compile to an exe:

echo "cat
echo “dog”;

Thanks,
Matthias

1 Like

Thank you for your feedback. Your request has been implemented into ExeOutput 2021.
It will be published soon.

Wow! That was a quick fix!
May I ask what exactly will be possible by this implementation?

Can I only style some text or would it be possible to just link to another PHP website?
Can the error be stored in a specific variable? If yes it would be possible to allow something like: “Something went wrong - do you want to transfer the error data to the developer” or you can display the PHP error in a good looking template so the customer could forward a screenshot.

Thanks and best regards,
Matthias

Great feature. I have struggled to find unique ways to catch those errors and display a custom message but all were wonky. This will be a welcome feature. Thank you support and @MatthiasB for bringing it alive.

ExeOutput for PHP now displays the standard error page instead of a white page. The error page can be customized in the “Dialog Boxes” tab of ExeOutput. So basically you can customize the entire HTML code and include your own CSS.

2 Likes

The new version is out. Enjoy!

1 Like

Hey,

I am currently playing with this new functionality.
Within the Error message dialog I’Ve put in the following content:

Then within the errorhandling.php I set the following text to work with the error:
exo_getglobalvariable (‘helasterrormessage’, ‘Undefined error’);

I want to go this way since I would like to use php code to handle the error which is not possible in the html error dialog.
Unfortunately the helasterrormessage variable is always empty. Am I doing something wrong?

Thanks for your help,
Matthias

If it’s a PHP error message, try to read this global variable instead: lastphperror
exo_getglobalvariable (‘lastphperror’, ‘Undefined error’);

Thanks for the fast response.
I found my problem which was the missing “echo” :frowning: lol

The following code works:
$error = exo_getglobalvariable (‘helasterrormessage’, ‘Undefined error’);
echo $error;

Your mentioned code always delivers “Undefined error”.

But I found 2 more points where I am not sure if these are expected limitations or something which can be sorted by configuration.

Point 1

For the following code I would expect 2 errors:
if($a==“1”){
echo “test”;
}
echo “blub”
return $smarty->fetch(‘test.htm’);

  1. $a is not defined
  2. the missing “;”

In case that I add the “;” then the error 1) is shown. In case that I remove the “;” then only the error message for the “;” is shown.
I would expect both error messages should be shown.

Point 2

In some cases I get the following message:
PHP Error: Error stored in php_errors.log file in EXE folder, provided that you enabled PHP error logging (in “PHP Settings / Debugging” in ExeOutput for PHP).

I have not found out yet under which condition this message is thrown. Looking into the php_errors.log then I can see 6x “PHP Notice: Undefined index:” messages. I would prefer to have this outcome instead of the generic message. Usually in production environment the php_errors.log is disabled.

Best regards,
MatthiasB

1 Like

Hi,

I saw that you liked my comment above.
Do you think this is something which we can handle? :slight_smile:

Thanks a lot,
Matthias

These notices can be disabled in PHP.INI, see this page:

Hi,

maybe there is a misunderstanding :slight_smile:
In some cases I get the following error message:

PHP Error: Error stored in php_errors.log file in EXE folder, provided that you enabled PHP error logging (in “PHP Settings / Debugging” in ExeOutput for PHP).

To me this looks like a message created by ExeOutput. Instead of this generic message I would like to receive the real php error which is the reason for this message.

Best regards,
Matthias

Hi,

The real error message is stored in the “php_errors.log” file (provided that the PHP error logging option (in “PHP Settings / Debugging” in ExeOutput for PHP) is checked.

Best regards!

Hi Wukong,

yes, this is understood :slight_smile:
For development purpose and troubleshooting this is perfectly fine but when I deliver a software to my customer then I want to turn this logging functionality off.

With the new devlopment to style the error page I do a redirect to an internal page. This internal page gives a feedback to the user that something went wrong and that the user does have the chance to forward the information to the software vendor. He can only click a “Send debug info” button.
When he clicks the button then the php error message is sent via JSON to my server so I can analyze and investigate.

In case of a basic error like

echo "hello; // missing "

this works perfect as I can see the php error and directly fix it.

In some cases I get the message

PHP Error: Error stored in php_errors.log file in EXE folder, provided that you enabled PHP error logging (in “PHP Settings / Debugging” in ExeOutput for PHP).

This does not help me since I do not have the php_errors.log file. This would require me to create a specific debugging file for my customer which is not so professional as if I could simply grab the error.
Some customer I do not know in person so this just even makes it more difficult.

This is the reason why I would like to have the error directly inside the application and not in a separate file.
I hope this makes sense.

Matthias

Hi Matthias,

I think I understand your need better (I haven’t tested the new error page management style yet).

If I’m not mistaken, the “Send debug info” button sends (or tries to send) the “error message” and not the “php_error.txt” file (which contains until now in my tests, the real error message). As a result, for some errors, you get the message :

PHP Error: Error stored in php_errors.log file in EXE folder, provided that you enabled PHP error logging (in “PHP Settings / Debugging” in ExeOutput for PHP)."

Right?

Personally I was planning to use the new style which replaces the white page in case of error, by the new stylized page to display in Front, a significant message (as already proposed), and in Back-End to send the file php_error.txt via phpMail (for example) in file attachment since I know the location of the file (which I would prefer moreover to have it in the folder “Data/log” for example since easier to communicate via php with the Data folder recognized as root". And make sure to delete the file if it exists, every time I start the app, so I don’t drag a file with old reports.

But if it’s possible to have the file sent by the app itself, I wouldn’t be against it either :slight_smile:.

Best regards!

Hi Wukong,

that is correct.
My “Error message” Dialog box contains the following content:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
 
<meta http-equiv="refresh" content="0; url=error.php" />
 
 </head>                                            
 <body> 
  
 </body>  
 </html>     

Within the error.php file I can catch the error with the following code:

$error = exo_getglobalvariable (‘helasterrormessage’, ‘Undefined error’);

And this result is something I can then send via JSON, email or whatever I like.
I do not want the php_error.log to be stored somewhere as this would give the chance to get more insights of the tool I developed. Also it might interfere with antivirus for example when it tries to access or delete the file.

As a side note I found out that as soon as you enable the php_error.log the enduser will not be redirected to the error page when above mentioned error message appears so you could not catch it. I am not sure if this behavior is by design.

Matthias

I see!

I myself for the moment do not activate php_error.log in production for the same reason as mentioned. I usually just leave a form in a report section to describe what went wrong in order to try to reproduce the potential bug in dev (not very practical and professional).

That’s why I was planning to do as said above provided that I could efficiently : Generate, retrieve and delete the log file in backend without giving the opportunity (at best possible XD) to the end user to see this file. I didn’t think about the potential interference with antivirus since I didn’t have these cases until now :thinking:.

I will keep an eye on this subject in case a better solution (existing or to come) is proposed.

Regards!

Hey,

maybe this ticket got lost in the queue. Today I got a new “crash report” from my app so I wanted to find out what went wrong.
Unfortunately the error message which was returned was just as follows:

PHP Error: Error stored in php_errors.log file in EXE folder, provided that you enabled PHP error logging (in “PHP Settings / Debugging” in ExeOutput for PHP)."

Therefore I had to call my customer to ask what he did. He just filled out a form and left some fields empty.
This would easily be visible in the php error log.

Any chance to return the errors instead of this generic message above?

Thanks a lot,
Matthias