2

On my Classic ASP sites, I have a script that uses Server.GetLastError to output the file, line and error message when a 500 error is encountered. This is then emailed to me so I can then use it to debug & fix the code.

Edit: to be clear, the Classic ASP solution uses a custom 500 page to send the details...

Is there something similar in PHP I can use for the same function?

Thanks

pnuts
  • 58,317
  • 11
  • 87
  • 139
JezB
  • 528
  • 1
  • 10
  • 26

1 Answers1

0

Depending on what you want, there are some third party applications out there that do that for you, like New Relic or AppNeta. These 2 are the ones I heard about/used, there are others as well. Or you can make your own, but I think that @Dexa's comment will only show you PHP related errors, and not server wide (apache, mysql...) The tools above can be configured to monitor other services.

LE: PHP uses several servers, for Apache you can use something like: http://httpd.apache.org/docs/2.2/custom-error.html

ErrorDocument 500 /500.php

For nginx you can use something like: nginx configure default error pages

In the file 500.php you can use the mail function.

Community
  • 1
  • 1
Emi
  • 1,018
  • 9
  • 13