Unable to communicate with H5P Hub | One site works one does not

Hello,

We have been using H5P extensively and it is a great tool! I have noticed a fair number of people running into issues in Wordpress with being unable to communicate with the H5P hub. I have been testing this on two different hosting companies and I am finding that one is working while the other is not. 

The server specs of the install not working:

https://www.evernote.com/l/Ain2rBRgLYlKA4VwGChASshNYgWRal2lEVw

Apache Version 2.4.16
PHP Version 5.5.30
MySQL Version 5.6.33
OS: Linux
Perl Version 5.8.8

The server specs of the install working:

Apache Version 2.4.27
PHP 5.6.31
MySQL Version 5.5.56-cll-lve
Linux
Perl Version 5.10.1

I have Wordpress debugging turned on for the install not working and nothing is being reported. Additionally, I have double checked the rights on the server directories and they are all set to 755. The PHP version difference stands out as being noticeably different. Could this be the issue?

Thank you,

Mike Agostinelli  | Instructional Program Director
Montana Digital Academy  |  University of Montana

 

 

 

icc's picture

First off, the plugin should be compatible with all PHP versions from 5.3 and up. Though, you really shouldn't use anything below 5.6 unless you really know what and why you're doing so, see Supported Versions.

There can be a number of reasons why H5P isn't allowed to download files, the best way to find out is to debug the code that fetches information. If you open the file wp-content/plugins/h5p/public/class-h5p-wordpress.php and add the following to line 892:

echo '<pre>'; print_r($response); exit;

So that it looks like this:

        // Use safe when downloading files
        $response = wp_safe_remote_get($url, $options);
      }
    }
echo '<pre>'; print_r($response); exit;
    if (is_wp_error($response)) {
      //$error_message = $response->get_error_message();
      return FALSE;

Next, you go to the H5P Settings page, and try to turn on/off the Use H5P Hub option and save the page. This should trigger the display of the debug information and you should be able to locate the error message.
It may be a missing PHP extension, network restrictions or something similar.

Let me know how it goes.