Imagine a couple of sites-enabled available from /etc/apache2/sites-available. (Only Debian-based distros work like this.)
Is it possible to mute warning messages from php scripts from a specific site, without touching the actual htdocs?
Normally there are a couple of solutions to achieve someting related:
- Add an
error_reporting()directive e.g.error_reporting(E_ERROR);to the scripts executed. - Set php_flags in
.htaccessfiles like so:php_flag display_errors off Use
ini_setinside scripts:ini_set('display_errors', 'Off'); ini_set('display_startup_errors', 'Off'); error_reporting(0);Prepend
@to functions that throw warnings or errors.- Change
php.inito actually say
error_reporting = E_ALL ^ E_WARNING
display_errors = 1
However, these all mean touching the htdocs or having the change applied globally. Imagine the htdocs are mounted read-only. How would I suppress warnings (or notices) for certain sites only?
I am assuming Debian/Ubuntu has a2ensite specific configurations for a reason and I am hoping I can alter those. There is a log_level directive in the example 'site available' configuration, but this handles the amount of messages logged. Not the messages output by the php scripts.
Manually adding sections in php.ini or apache2.conf or httpd.conf will also work. If it is possible.
See also: