Jump to content

Recommended Posts

Posted

Why are my PHP scripts errors not being displayed? Instead, the server is throwing a 500 internal error.

 

I've already tried to add the 'display_errors' php flag to .htaccess file, but it doesn't seem to work, it keeps on returning the same 500 error.

 

My site url is: kiskadee.heliohost.org

 

Thanks in advance for any kind of help.

Posted

PHP errors are off by default. I had to recompile a few versions of php a while back, and simply forgot to turn errors back on.

Posted

It sounds like it might be helpful to point out, for any users who've just discovered lots of error messages suddenly announcing themselves to the public, that error display in pages can be disabled with the "display.errors = off" setting in a .user.ini file placed in the web pages directory.

 

Errors can be set to be written to a file using these directives:

log_errors = on
error_log = "~/logs/phperrors.txt"

 

"~/logs/phperrors.txt" could be any other directory that's convenient. "error_reporting =" can also be included to determine which errors get written/displayed (see the PHP manual for option descriptions).

 

I also have "display_startup_errors = off", but that probably isn't now on by default.

Posted
error_reporting(0);

Added to the code will also prevent their display.

 

Our system already logs the errors to error_log in the same folder as the script, though your method should allow you to prevent the logging or change the filename or location if desired.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...