ubuntu - Change php error reporting to hide warnings for specific site only -
imagine couple of sites-enabled
available /etc/apache2/sites-available
. (only debian-based distros work this.)
is possible mute warning
messages php scripts a specific site, without touching actual htdocs
?
normally there couple of solutions achieve someting related:
- add
error_reporting()
directive e.g.error_reporting(e_error);
scripts executed. - set php_flags in
.htaccess
files so:php_flag display_errors off
- use
ini_set
inside scripts:
ini_set('display_errors', 'off');
ini_set('display_startup_errors', 'off');
error_reporting(0);
- prepend
@
functions throw warnings or errors. - change
php.ini
say
error_reporting = e_all ^ e_warning
display_errors = 1
however, these mean touching htdocs or having change applied globally. imagine htdocs
mounted read-only. how suppress warnings (or notices) sites only?
i assuming debian/ubuntu has a2ensite
specific configurations reason , hoping can alter those. there log_level
directive in example 'site available' configuration, handles amount of messages logged. not messages output php scripts.
manually adding sections in php.ini
or apache2.conf
or httpd.conf
work. if possible.
see also:
you can control many of php's config options inside .htaccess file, give control specific directory. general format is:
php_value <config_key> <config_value>
or, boolean values:
php_flag <config_key> <on|off>
in case, it'd be:
php_flag display_errors off
Comments
Post a Comment