kiskadee Posted December 9, 2018 Posted December 9, 2018 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.
kiskadee Posted December 9, 2018 Author Posted December 9, 2018 (edited) According to cPanel information, the php version I'm using is ea-php56. Edited December 9, 2018 by kiskadee
kiskadee Posted December 9, 2018 Author Posted December 9, 2018 Yes, now it works! Thank you. Can you tell me what, exactly, was the "problem"?
Krydos Posted December 9, 2018 Posted December 9, 2018 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.
Computer Nerd Kev Posted December 10, 2018 Posted December 10, 2018 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 = onerror_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.
wolstech Posted December 10, 2018 Posted December 10, 2018 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now