Let me quickly summarize this for reference:
error_reporting()
adapts the currently active setting for the default error handler.
Editing the error reporting ini options also changes the defaults.
Here it's imperative to edit the correct php.ini
version - it's typically /etc/php5/fpm/php.ini
on modern servers, /etc/php5/mod_php/php.ini
alternatively; while the CLI version has a distinct one.
Alternatively you can use depending on SAPI:
.htaccess
with php_flag
optionsphp.ini
.user.ini
Restarting the webserver as usual.
If your code is unwieldy and somehow resets these options elsewhere at runtime, then an alternative and quick way is to define a custom error handler that just slurps all notices/warnings/errors up:
set_error_handler(function(){});
Again, this is not advisable, just an alternative.