0

Is it possible to prevent logging of a specific type of PHP warning? I do not want to disable warnings entirely, I just want to disable error logging of things like this:

[Wed May 12 11:20:17.630952 2021] [:error] [pid 25301] [client 127.0.0.1:57710] PHP Warning:  mysqli::mysqli(): (28000/1045): Access denied for user 'apache'@'localhost' (using password: NO) in /www/public_html/example.com/myphpfile.php on line 11, referer: https://example.com/anotherfile.php

while keeping warnings like this one:

[Wed May 12 11:23:21.355798 2021] [:error] [pid 21467] [client 127.0.0.1:49508] PHP Warning:  Illegal string offset 'someindex' in /www/public_html/example.com/index.php on line 296, referer: https://example.com/somescript.php?param=1234

My error_reporting line in /etc/php.ini looks like this:

error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE
FiddlingAway
  • 123
  • 6

1 Answers1

0

Fix the issue in the PHP file or script's configuration. You should treat every warning as a possible bug, and you want to keep you system as free from bugs as possible.

Tero Kilkanen
  • 34,499
  • 3
  • 38
  • 58
  • While I agree with you, I'm not the owner of the script. The folks who made it are not forthcoming when it comes to fixing it, so I was wondering if I could do anything on my end of things. – FiddlingAway May 13 '21 at 06:36
  • Then you can create the user the script is trying to use. – Tero Kilkanen May 13 '21 at 19:36