DreamHost fix for: errorlog_enable: error_reporting() must be set to -1, not -10251!

2 posts by 2 authors in: Forums > CMS Builder
Last Post: Yesterday at 5:21am   (RSS)

Hi all, 

DreamHost recently made a change to their default server configuration that prevents websites from logging warnings or errors unless especially configured to do so.

If you're getting this error or something similar: errorlog_enable: error_reporting() must be set to -1, not -10251!

Try this fix, edit /lib/init.php and search for: error_reporting(-1);

Then replace it with this code:

if (extension_loaded('dh_php_ext')) {
    // Override DreamHost extension that prevents error_reporting from enabling these flags:
    // https://help.dreamhost.com/hc/en-us/articles/215572277-PHP-FAQs#h_01J4J1KFPJTJNS9JBGK3ASTNNN
    ini_set('error_reporting_allow_deprecated', '1');
    ini_set('error_reporting_allow_notice', '1');
    ini_set('error_reporting_allow_strict', '1');
    ini_set('error_reporting_allow_warning', '1');
}
error_reporting(-1);


Technical details: They have a custom dh_php_ext php extension that prevents enabling error reporting for (deprecated, notice, strict, or warning).  So you can never set error_reporting() to -1 (which means all) since it will never let you flip those bits. However, their extension also allows disabling that functionality with the above flags.

Let me know if that works for you.

Dave Edis - Senior Developer
interactivetools.com