Nicsoft Nicsoft - 1 year ago 110
Linux Question

Stop printing php error messages to browser

I'm using PHP 5.3, CentOS 6.2, httpd 2.2.15, NetBeans 7.0.1 (running remotely via ftp).

I want to stop printing error messages to the browser, it's enough that it prints to the error_log of httpd.

I thought by doing try/catch I would decide on my own how to handle the error but it still prints to both error_log and browser.

function smic_gettext($phrase){

$tr_text = $this->language_array[$phrase];

} catch(Exception $e){
error_log("Couldn't find any entry in the translation file for ".$phrase.". ".$e);
return $phrase;


return $tr_text;

How should I configure in order to stop this behaviour?

I have tried setting display_errors=Off and display_errors=0 in php.ini. No difference (I did restart httpd).

Answer Source
display_errors = Off

in php.ini will let you keep your syslog errors, but write nothing to the browser.