PHP: Stop Notice and Variable Warnings in Error Log Files

To stop PHP from logging notices and warnings to error log files, you can adjust the error_reporting setting in the php.ini file.

Here’s how to make this change:

  1. Locate your php.ini file. On Linux, it’s usually located at /etc/php.ini.
  2. Open the php.ini file in a text editor.
  3. Find the error_reporting setting. It’s usually near the top of the file. (Zolpidem)
  4. Change the value to E_ALL & ~E_NOTICE & ~E_WARNING. This will log all errors except notices and warnings.
  5. Save the file and exit the text editor.
  6. Restart your web server for the changes to take effect.

After you’ve made these changes, notices and warnings will no longer be logged to your error log files.

Leave a Comment