PHP: Stop Notice and Variable Warnings in Error Log Files

w‮tual.ww‬turi.com
PHP: Stop Notice and Variable Warnings in Error Log Files

To stop PHP from logging notice and variable warnings in error log files, you can modify the error_reporting setting in the PHP configuration file (usually php.ini).

To disable notice and variable warnings, you can set error_reporting to a value that excludes these error types. For example:

error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING

This will enable all error types except for notice and variable warnings.

Alternatively, you can use the error_reporting function in your PHP code to control the types of errors that are logged. For example:

<?php
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);

This will disable notice and variable warnings for the duration of the script.

It's important to note that disabling notice and variable warnings may not be recommended in all cases. These errors can provide valuable information about potential issues with your code, such as uninitialized variables or deprecated functions. Consult the PHP documentation and online resources for more information on error handling and reporting in PHP.

Created Time:2017-10-30 14:27:09  Author:lautturi