Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP 5.4 500 Internal Server Error with display_errors off

Tags:

php

I need PHP errors not to be displayed but logged. I am using PHP 5.4 My current code to log errors in my php.ini is:

log_errors = 1
error_log = "/path-to-file/error_log.txt"

Which works however I am getting a 500 internal server error trying to turn error displaying off using display_errors. I have tried using the following, all returning 500 errors.

display_errors = 0
display_errors = "0"
display_errors = false
display_errors = "false"
display_errors = Off
display_errors = "Off"

According to the PHP documentation, as of PHP 5.4, it is a string. What am I suppose to set display_errors to to turn error displaying off?

like image 260
Ethan H Avatar asked Oct 07 '22 16:10

Ethan H


1 Answers

a 500 error code means there is an invalid server configuration. This is most likely coming from Apache and not from php.

To get a clear understanding on what is giving you the error, look at your apache logs.

If you wish to also hide the 500 error, you could open your httpd.conf file and add

ErrorDocument 500 " "

Then make sure to restart apache. Any time you make a config change to php.ini or httpd.conf you will need to restart apache for it to take into effect.

like image 185
Kris Avatar answered Oct 13 '22 10:10

Kris