Freddy
Freddy

Reputation: 349

logging PHP fatal errors

I have my website on a managed server where i do not have any possibility to configure any php errors since I do not have access to the php.ini

The problem I am facing is that my server provider does not log php errors. I am able to catch (via exceptions) other errors as for example notices but it is not possible to catch fatal errors.

Since I do not have any access to an error log, I do not know whether some of my visitors face fatal errors on my website ...

I already asked my provider but they just told me that they do not log the errors and will not do it in the future. I really want to keep my managed server for maintenance reasons.

Is there any other possibility to track or log fatal errors so that I do not have change anything in the configuration?

Best regards,

Frederic

Upvotes: 0

Views: 873

Answers (2)

Mike Brant
Mike Brant

Reputation: 71384

Between set_error_handler() and register_shutdown_function() you should be able to define custom logic to handle all your errors, exceptions, fatal errors, etc..

Upvotes: 1

Travesty3
Travesty3

Reputation: 14469

You can handle this using PHP's set_error_handler function. When an error is thrown, you can log the error to your own text file, or have it emailed to you, or whatever you want to do.

Upvotes: 0

Related Questions