MyBB Community Forums

Full Version: PHP 7.2 compatibility issues
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Good afternoon,

My site http://sailormoon.ethereal-visions.net is hosted on Dreamhost. I’ve been with them for years (2005) with no problems. At least not until their PHP version upgraded to PHP 7.2, when my site was previously on PHP 5.6. Dreamhost plans on removing PHP 5.6 (and rightfully so) soon, but I can’t seem to get my site to work when it’s on newer versions of PHP.

I do run mods on my site, my biggest ones are MyAlerts, Enhanced Account Switcher, Mention Me and Pages.  I’ve tried following the .htaccess hack found here https://help.dreamhost.com/hc/en-us/articles/214200788 to no avail. I’m at a total loss at the moment, and my site’s been constantly going offline.

Some assistance would be greatly appreciated! None of my members can access the site when it isn’t running PHP 5.6. I’m currently running MyBB 1.8.21.
What are the issues when you upgrade to php 7.2?
Take a look into PHP error logs, generated either by:
Problems related to PHP compatibility usually result in PHP errors/warnings displayed on the site and/or logged in one of those locations (a blank page or a generic error may be shown instead when that happens). If filenames are present, it may give you some idea which plugin(s) are causing problems, and in which places.

If MyBB's unmodified core files are mentioned in these logs instead, it may indicate an issue with MyBB itself, in which case they will likely be addressed in the next maintenance release (and administrators will be able to apply a proposed patch manually before the release).
I had a few issues when I upgraded to php 7.2 but they were all plugin related.  I had to remove a few plugins to get it working right!
From 11/20/2019, which was when it happened the most. A # was placed to hide sensitive information.

[client #[client #] ModSecurity: Rule 3e2da99b1e8 [id "390900"][file "/#/template/etc/mod_sec2/50_asl_rootkits.conf"][line "64"] - Execution error - PCRE limits exceeded (-8): (null). [hostname "sailormoon.ethereal-visions.net"] [uri "/index.php"] [unique_id "XdVBo6q8NgBbHou9LRcd9gAAAAk"]
] ModSecurity: Rule 3e2ca5f01e8 [id "390900"][file "/#/template/etc/mod_sec2/50_asl_rootkits.conf"][line "64"] - Execution error - PCRE limits exceeded (-8): (null). [hostname "sailormoon.ethereal-visions.net"] [uri "/newreply.php"] [unique_id "XdVW4jOJ1fCBz3CWXU@gUwAAAAE"]
[client #] ModSecurity: Rule 3e2ca5f01e8 [id "390900"][file "/#/template/etc/mod_sec2/50_asl_rootkits.conf"][line "64"] - Execution error - PCRE limits exceeded (-8): (null). [hostname "sailormoon.ethereal-visions.net"] [uri "/showthread.php"] [unique_id "XdVboZdKF6zbhDmPz9pZGAAAAAc"]
[client #] ModSecurity: Rule 3e2ca5f01e8 [id "390900"][file "/#/template/etc/mod_sec2/50_asl_rootkits.conf"][line "64"] - Execution error - PCRE limits exceeded (-8): (null). [hostname "sailormoon.ethereal-visions.net"] [uri "/forumdisplay.php"] [unique_id "XdVW4FqSUPetGAm@P3JjcQAAAA8"]
MyBB is ready for PHP7.
So it really seems to be an issue with any of your plugins mentioned.
Did you updated plugins as well when there was an update available?

(2019-11-21, 05:55 PM)Vii Wrote: [ -> ][...]
I do run mods on my site, my biggest ones are MyAlerts, Enhanced Account Switcher, Mention Me and Pages. [...]
I’m currently running MyBB 1.8.21.
Did you mod the MyBB core files or do you just refer to plugins?

The most likely issues after switching to PHP7 are obsolete database functions mysql_*... that mandatory needs to be changed to mysqli_* functions to be still working on PHP7.

I suggest to check all of your plugin versions first and also check PHP files for deprecated PHP functions.

[ExiTuS]
Quote:ModSecurity: Rule 3e2ca5f01e8 [id "390900"][file "/#/template/etc/mod_sec2/50_asl_rootkits.conf"][line "64"] - Execution error - PCRE limits exceeded (-8): (null).
The trouble seems to come from mod_security, not from PHP
Only one of the mods that I used seemed to be out of date and that was Enhanced Account Switcher, which was promptly upgraded after that discovery. I haven't yet switched to PHP 7 as it's a process on Dreamhost to switch it back to 5.6 (I have to contact support in order to do so). Is there a way to tell beforehand that that actually resolved the issue?

Otherwise how can I determine which mod is causing that error? I also did not modify any of the plugins or the core MyBB files except for global.php, which was to add my custom global templates.
First, mod_security is an apache (web server) module, not a mybb one.
If you think that it's a mybb' plugin which provocs this error, deactivate them all and reactivate them one by one, you'll find which one has a rootkit signature (probably a positive false)
So, after disabling the mods that I have I've determined that it isn't related to the mods at all. I've also gone and updated all of them. I've also tried re-uploading new versions of the primary folder to no avail. Using a handler doesn't work either to force it, and web security is disabled. It's currently loading PHP 7.1. What I can access is the ACP, but that's it. I get this error when loading the main site:

This page isn’t working sailormoon.ethereal-visions.net is currently unable to handle this request.
HTTP ERROR 500

[Sat Nov 23 02:08:11.864422 2019] [cgi:error] [pid 15014] [client #] AH01215: PHP Fatal error:  Uncaught Error: Using $this when not in object context in /home/#/sailormoon.ethereal-visions.net/global.php(958) : eval()'d code:105: /dh/cgi-system/php71.cgi, referer: http://sailormoon.ethereal-visions.net/index.php
[Sat Nov 23 01:56:34.662196 2019] [cgi:error] [pid 15033] [client #:1389] AH01215: PHP Fatal error:  Uncaught Error: Using $this when not in object context in /home/#/sailormoon.ethereal-visions.net/global.php(958) : eval()'d code:105: /dh/cgi-system/php71.cgi
[Sat Nov 23 01:56:34.662383 2019] [cgi:error] [pid 15033] [client #:1389] AH01215: Stack trace:: /dh/cgi-system/php71.cgi
[Sat Nov 23 01:56:34.662722 2019] [cgi:error] [pid 15033] [client #:1389] AH01215: #0 /home/#/sailormoon.ethereal-visions.net/global.php(958): eval(): /dh/cgi-system/php71.cgi
[Sat Nov 23 01:56:34.663180 2019] [cgi:error] [pid 15033] [client #:1389] AH01215: #1 /home/#/sailormoon.ethereal-visions.net/showthread.php(28): require_once('/home/#...'): /dh/cgi-system/php71.cgi
[Sat Nov 23 01:56:34.663238 2019] [cgi:error] [pid 15033] [client #:1389] AH01215: #2 {main}: /dh/cgi-system/php71.cgi
[Sat Nov 23 01:56:34.663676 2019] [cgi:error] [pid 15033] [client #:1389] AH01215:   thrown in /home/#/sailormoon.ethereal-visions.net/global.php(958) : eval()'d code on line 105: /dh/cgi-system/php71.cgi


This is the only modification that I have in global.php, and I know it's not because of that because I removed it and re-enabled it. All other data in global.php is otherwise consistent with the original code.

// Set up some of the default templates
eval('$affiliates = "'.$templates->get('affiliates').'";');
eval('$submenu = "'.$templates->get('submenu').'";');
eval('$cbox = "'.$templates->get('cbox').'";');
eval('$disclaimer = "'.$templates->get('disclaimer').'";');
eval('$newsarea = "'.$templates->get('newsarea').'";');
eval('$customscripts = "'.$templates->get('customscripts').'";');

eval('$headerinclude = "'.$templates->get('headerinclude').'";');
eval('$gobutton = "'.$templates->get('gobutton').'";');
eval('$htmldoctype = "'.$templates->get('htmldoctype', 1, 0).'";');
eval('$header = "'.$templates->get('header').'";');

Line 105:
if(function_exists('mb_internal_encoding') && !empty($lang->settings['charset']))
{
	@mb_internal_encoding($lang->settings['charset']);
}

Based on that line of code I also went and converted the database to UTF-8, but to on success on the actual site. It did however come back with this error:

For full 4-Byte UTF-8 support you need to change $config['database']['encoding'] = 'utf8'; to $config['database']['encoding'] = 'utf8mb4'; in your inc/config.php.

I went ahead and did that to no success.
Pages: 1 2