from runtime it is better (and more reliable) to use:
error_reporting(0);
see: http://php.net/manual/en/function.error-reporting.php for more info.
also you can suppress any errors regarding of reporting level by prefixing expression with @
:
@copy(...)
see: http://php.net/manual/en/language.operators.errorcontrol.php for more info, also note what this cause a performance drop and causes expression to return boolean false if error occured, regardless of its original return type.
Worth noting:
If you are using nginx+php-fpm (or similar) ini values may be overriden in php-fpm's pool configuration.
If you are using apache+mod_php ini values may be overriden in .htaccess file.
Check that, before resolving to error_reporting(0)
, turning off error_reporting completely is not what you should do, as this may lead to broken logic (many popular libraries and frameworks rely on error reporting by setting handlers to traslate errors to exceptions).
In terms of portability use of error suppressing operator is preferred, dispite its affect on performance.