Compatibility issues between H5P and PHP 8.1

Hello,

We use H5P extensively in both WordPress and our LMS. However, after upgrading our WordPress environment to PHP 8.1, we encountered an issue where all embedded H5P content is missing from the website.

I was wondering if there are any known compatibility issues between H5P and PHP 8.1, or if there are any steps we should take to resolve this.

papi Jo's picture

Hello

You write "WordPress and our LMS" which LMS is that?

Anyway, I am running WordPress 6.6.2 with PHP 8.2.13 and H5P plugin 1.16.0 and all is working fine.

"all embedded H5P content is missing from the website" This is too vague, can you provide more precise details?

Hi Papi, 

My apologies for the oversight. We are currently running WordPress (WPMS) 6.6.2 with PHP 8.1 and H5P plugin version 1.16.0. After upgrading to PHP 8.1, all embedded H5P content across our sites has disappeared, leaving only blank spaces without displaying any error. We tried upgrading to PHP 8.2.13 but still running into the same issue. I hope this helps. 

 

otacke's picture

without displaying any error

Have you checked the development console and the PHP error log? Cmp. https://snordian.de/2024/02/17/how-can-i-craft-an-effective-bug-report-for-h5p-components/

Have you checked the H5P settings dealing with embedding (just to make sure)?

Here is what I'm getting from the console.

Unable to find constructor for: H5P.ImageHotspots 1.10

Uncaught TypeError: Cannot read properties of undefined (reading 'getCopyrights')

    at H5P.getCopyrights (h5p.js?ver=1.16.0:1139:16)

    at HTMLDivElement.<anonymous> (h5p.js?ver=1.16.0:174:30)

    at Function.each (jquery.js?ver=1.16.0:2:2976)

    at S.fn.init.each (jquery.js?ver=1.16.0:2:1454)

    at H5P.init (h5p.js?ver=1.16.0:93:60)

    at HTMLDocument.<anonymous> (h5p.js?ver=1.16.0:2879:11)

    at e (jquery.js?ver=1.16.0:2:30005)

    at t (jquery.js?ver=1.16.0:2:30307)

    at Function.each (jquery.js?ver=1.16.0:2:2976)

    at S.fn.init.each (jquery.js?ver=1.16.0:2:1454)

    at H5P.init (h5p.js?ver=1.16.0:93:60)

    at HTMLDocument.<anonymous> (h5p.js?ver=1.16.0:2879:11)

    at e (jquery.js?ver=1.16.0:2:30005)

    at t (jquery.js?ver=1.16.0:2:30307)

otacke's picture

These are (JavaScript) error messages from the browser's development console. They merely indicate that the required library seems to not have been loaded. The reason is unclear though. If this is an error caused by some PHP 8.1 incompatibility, you should find a hint in the PHP error log. Another cause, however, may be other WordPress plugins that defer loading JavaScripts in order to optimize the site loading experience for the user. The order in which JavaScripts are loaded is crucial here, however, and if another plugin messes with the order, things can go south.

papi Jo's picture

Oliver wrote "Another cause, however, may be other WordPress plugins that defer loading JavaScripts in order to optimize the site loading experience for the user. "

In order to check that suggestion, the OP should disable ALL the WP plugins on their WP site; check that then the HP contents do work, and then re-enable those plugins one by one until the "culprit" is found.

I have disabled all WordPress plugins and reinstalled H5P, but the issue still persists. Below is the PHP error I am encountering.

 

PHP Warning:  PHP Startup: Unable to load dynamic library 'tidy.so' (tried: /usr/local/lsws/lsphp81/lib64/php/modules/tidy.so (/usr/local/lsws/lsphp81/lib64/php/modules/tidy.so: cannot open shared object file: No such file or directory), /usr/local/lsws/lsphp81/lib64/php/modules/tidy.so.so (/usr/local/lsws/lsphp81/lib64/php/modules/tidy.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

PHP Warning:  Module "igbinary" is already loaded in Unknown on line 0

PHP Warning:  PHP Startup: Unable to load dynamic library 'json.so' (tried: /usr/local/lsws/lsphp81/lib64/php/modules/json.so (/usr/local/lsws/lsphp81/lib64/php/modules/json.so: cannot open shared object file: No such file or directory), /usr/local/lsws/lsphp81/lib64/php/modules/json.so.so (/usr/local/lsws/lsphp81/lib64/php/modules/json.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

PHP Startup: Unable to load dynamic library 'tidy.so' (tried: /usr/local/lsws/lsphp81/lib64/php/modules/tidy.so (/usr/local/lsws/lsphp81/lib64/php/modules/tidy.so: cannot open shared object file: No such file or directory), /usr/local/lsws/lsphp81/lib64/php/modules/tidy.so.so (/usr/local/lsws/lsphp81/lib64/php/modules/tidy.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

PHP Warning:  Module "igbinary" is already loaded in Unknown on line 0

 

otacke's picture

These look like error messages from LiteSpeed Web Server which seemingly indicate that the tidy extension for PHP is not installed.