MyBB Community Forums

Full Version: Turn off MyBB deprecated warning messages
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm currently on PHP 8.2 and deprecated function warnings are showing up on my forums even though I have them turned off (at least I think so). The warnings only show up on my forums, and not on the other locations on my website.

Here's a very old thread as an example: https://ravenrepublic.net/forums/showthr...p?tid=3176

Yet, the following are currently true:

1. My domain is set to PHP 8.2.

2. In my WHM MultiPHP Manager, for PHP 8.2 I've set the PHP-FPM settings for Error Reporting to the following:
E_ALL & ~E_NOTICE & ~E_DEPRECATED

3. In my WHM MultiPHP Editor, for PHP 8.2, under Basic Mode, I have display_errors disabled.

4. In my WHM MultiPHP Editor, for PHP 8.2, under Editor Mode, I have the following line in php.ini: 
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED 

5. In the actual php.ini file under my domain, I also copied the line from number 4.

Any idea what I'm missing?
ACP » Home » Board Settings » Server and Optimization Options
Check Use Error Handling setting and others options about errors.
(2023-03-01, 07:39 AM)Crazycat Wrote: [ -> ]ACP » Home » Board Settings » Server and Optimization Options
Check Use Error Handling setting and others options about errors.

I tried turning MyBB's error handling on and off, and "Hide Errors and Warnings" when it was on. Still getting the warnings unfortunately.
What does phpinfo() report for settings?
Maybe I have it wrong, but when display_errors is On, that allows MyBB to process them according to MyBB configuration settings.
The named settings are converted to bit values. On my server error_reporting is set to 32759

This link may help you convert backwards to see exactly what is configured.
https://www.php.net/manual/en/errorfunc.constants.php

There may be a another configuration which is overriding something, since error_reporting can be set in many places.
https://www.php.net/manual/en/configurat....modes.php


32759 (decimal) is 111111111110111 (binary) which reports everything except E_NOTICES.
This corresponds with my php.ini setting.
Interesting... phpinfo() from the Admin CP displays the following:

display_errors:
Local Value: On
Master Value: Off

error_reporting:
Local Value: 32765
Master Value: 24567

Comparing the values in this handy calculator shows that the master value is what I want, but somehow it's not translating to the local value!

Looking at your second link, I looked at php.ini and .user.ini in my main domain, since that's the only location where they're at. They correspond to what I'm expecting, so my conclusion is there's something in the forums folder which is overwriting the settings. And yet /forums/ doesn't have a php.ini or .user.ini file of its own.

I've tried creating this rule in my forum's .htaccess file, but it doesn't seem to be doing anything:
<IfModule php8_module>
    php_value error_reporting 24567
</IfModule>
My VPS doesn't always put config files (or error logs for that matter) where apache, whm or cpanel documentation says they should be.
If you have command line access to root, use
find -name php.ini
to show where they may be. Then try to decipher which ones are applicable to running your server instance.

From your handy calculator, you could consider setting it in MyBB code.

Set error reporting in PHP at runtime
<?php error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED); ?>

Where it could go to have an effect and what scope the effect would be is unknown.
...I finally solved it.

It was a plugin. So yeah, something in my forums folder was overwriting my settings. It had this line in it:

ini_set('display_errors', 1);

Once I commented the line out, the deprecated error messages went away.
Good catch and an interesting find.
+1