Change php error reporting to hide warnings for specific site only [Debian|Ubuntu]
Solution 1:
If you have access to the apache vhost configurations, of course you can also use php_flag directives inside a Virtual Host in the sites-available directory. This way, they're only applied to this vhost.
Add something like this inside your Virtual Host:
<IfModule mod_php5.c>
php_admin_flag display_errors off
</IfModule>
EDIT:
If you want only actual errors displayed, you can use the php directive error_reporting
with an integer value that describes the types of error levels you want to be displayed:
<IfModule mod_php5.c>
php_admin_flag display_errors on
php_admin_value error_reporting 22517
</IfModule>
This is equivalent to a setting of
error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT & ~E_DEPRECATED;
in php.ini. More possible values for example here:
https://web.archive.org/web/20131009000719/http://www.websitefactors.co.uk/php/2013/01/php-error-reporting-settings
Error reporting value calculator:
http://www.bx.com.au/tools/ultimate-php-error-reporting-wizard
Solution 2:
I added :
<IfModule mod_php5.c>
php_admin_flag display_errors on
php_admin_value error_reporting 30711
</IfModule>
to /etc/apache2/sites-enabled/work and thats working just fine.
Yes I know I should fix those notices, but I'm working on a old script, and will need to come back to that, for now this has solved my problem, and was what the op was looking for. Hope this helps someone.