failed upload of new question

Hi - we installed H5P on our test server running WP 3.2.1 and it worked beautifully - THe test server is on an linux server on AWS

So installed on our live site on the University server - same version of WP and H5P. The plugin installed ok, but hwne we tried to upload a file via the upload new question option we get:

failed to open stream: Read-only file system  xxx/wp-content/plugins/h5p/admin/class-h5p-plugin-admin.php on line 395

(the line code on this file is   "rename($_FILES['h5p_file']['tmp_name'], $interface->getUploadedH5pPath());)"

If we try and upload directly into the library we get:

Warning: file_get_contents: failed to open stream: no suitable wrapper could be found in xxxx/wp-content/plugins/h5p/h5p-php-library/h5p.classes.php on line 2304

This is a multisite installation and we have tried network and single site installation - neither work. 

falcon's picture

Thank you for reporting. We've added this issue to our backlog. You'll be notified here as soon as your issues has been handled.

If you should need a support arrangement for H5P you may contact an H5P Service Provider.

according to our IT the libraries upload is failing becuase open URLs are blocked by our server as a security measure - so we get this error messsage

Warning: file_get_contents(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /xxx/wp-content/plugins/h5p/h5p-php-library/h5p.classes.php on line 2305

Is there any way we can upload /create questions into H5P without cahnging this (which we cant do!)

icc's picture

What version of the plugin are you using? This should have been fixed a while ago, and you should be able to upload files without allow_url_fopen enabled.

H5P v 1.5.4 . Its not saying there are any updates available?

WP is version 4.2.5

icc's picture

Ok, then it's very strange that you receive this error. Do you have access to the plugin files so that you can debug? If you add the following before line 2305 in h5p/h5p-php-library/h5p.classes.php:

var_dump($path); exit;

And then try to upload the file, it should tell us which part that is failing.

Thanks for this - we added the code and got the attached json  - I've also attached an image how the library page looks when trying to add file

icc's picture

Ok, thank you. Since this code isn't really used it should be safe to remove it. If you can uncomment or remove the lines 1317 and 2002 you should get rid of these messages. The two lines should both contain:


Let me know how it goes. 

Sorry but no luck. Still getting the same error

icc's picture

I have to apologize, it seems like I was looking in the wrong place. This is indeed a bug, you should undo your previous changes or just re-install the plugin. To fix these errors you simply have to replace line nr 175 in h5p/admin/class-h5p-library-admin.php. It looks like this:

$minVersions = $core->getMinimumVersionsSupported(plugins_url('h5p/h5p-php-library/library-support.json'));

But it should look like this:

$minVersions = $core->getMinimumVersionsSupported(plugin_dir_path( __FILE__ ) . '../h5p-php-library/library-support.json');

I have added this fix to the plugin, so it will be part of the next version.

Thank you for reporting this issue!

Thanks. Have tried this and the error message re the open URL has gone, but still getting this:

 Sessions/drag-the-words-1399.h5p): failed to open stream: Read-only file system xxx/wp-content/plugins/h5p/admin/class-h5p-plugin-admin.php on line 395


  • The file you uploaded is not a valid HTML5 Package (We are unable to unzip it)

so not able to upload



icc's picture

Ok, is seems like you were having two separate issues. This last one seems to be cause by PHP not being able to write to its tmp folder. This is the folder configured in php.ini as 'upload_tmp_dir', or if not present sys_get_temp_dir() is used. Are there any reasons why you've set up PHP without a writable tmp directory?

You can get around this by setting another tmp path in public/class-h5p-wordpress.php:93, but I would recommend just setting the 'upload_tmp_dir' in php.ini to something usable.

Unfortunately the server is controlled by the University IT, so php.ini is not availble to us - so changed the path destination for the temp folder and this worked. 

Thanks for all your help