I had a problem with my cloud server and all my sites were generating 500 errors. The response page the visitor saw varied between Craft 2, Craft 3 and ExpressionEngine 2 sites. The Craft 3 ones showed:
CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1 Can't create/write to file '/tmp/#sql3fa0.MYI' (Errcode: 28)
Some showed what I think is the generic cPanel page:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at email@example.com to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
Others a blank page.
I now want to have a nice/useful/descriptive 500 error page shown if it happens again. So after reading up on this, in particular, the NY Studio 107 article on error pages I want to be able to test if my new 500 error page does get shown when there is a real 500 error situation.
The hosting company suggested adding a 500.html file in the public_html, adding ErrorDocument 500 /500.html to my .htaccess and creating a script file with this in it:
<?php ini_set('display_errors', 0); throw new Exception('Test'); ?>
and calling it in the browser, but it didn't work. Their response was:
Sorry, in this case the HTTP 500 error is not caught by Apache in a way it can handle it. There are ways of doing PHP error handling in PHP, but it will depend on the application to do it for you.
Any suggestions as to how to test that it's all working properly?