Error while using WordPress plugin

Hi H5P,

I'm getting some errors while using the H5P plugin in WordPress and can't figger out why this is happening. The error is:

Warning: copy(/home/lobr1100/domains/lobr1100.iminor.nl/public_html/wp-content/uploads/h5p/temp/h5p-58a6c06abad87) [function.copy]: failed to open stream: No such file or directory in /home/lobr1100/domains/lobr1100.iminor.nl/public_html/wp-content/plugins/h5p/h5p-php-library/h5p-default-storage.class.php on line 144


The content on this page is working properly, but the error is also posted on the page: http://lobr1100.iminor.nl/index.php/sample-page/year-1/chapter-3/grammar...

I was hoping you know this issue and can help me out.

Regards,

Douwe van der Leij

thomasmars's picture

Hi,

what version of the H5P plugin are you using ?

Hi - hate to bring this up, but I'm also seeing the same error on both the edit screen and the embeded front end screen

Front end:

Warning: copy(/data/httpd/efolio/htdocs/blog/wp-content/blogs.dir/11388/files/h5p/temp/h5p-58ac24eba5314): failed to open stream: No such file or directory in /data/httpd/efolio/htdocs/blog/wp-content/plugins/h5p/h5p-php-library/h5p-default-storage.class.php on line 157

Back end

Warning: copy(/data/httpd/efolio/htdocs/blog/wp-content/blogs.dir/11388/files/h5p/temp/h5p-58ac24cb8aae3): failed to open stream: No such file or directory in /data/httpd/efolio/htdocs/blog/wp-content/plugins/h5p/h5p-php-library/h5p-default-storage.class.php on line 157

Also seeing "Unable to save H5P export file." when we go to edit the object.

This WAS working but we started seeing the "public_html/wp-content/plugins/h5p/h5p-php-library/h5p-default-storage.class.php on line 144" error message (as above for Douwe van der Leij). Upgrading to  1.7.11 changed the error mesage from line 144 to line 157.

So basically, all was ok. Then editing the object caused this error.

We use this for a couple of dozen blogs and I'mg etting report from many academics of this issue. For all types of content.

I've reported it before, I'm glad its not just me seeing the issue.

Alex

 

icc's picture

Would you mind testing my fix below? 
(not sure if you got a notification on my post)

icc's picture

I'm not able to reproduce the error, but I have a theory on what's wrong. Do any of you mind testing a possible fix?

Comment out lines 1599 and 1600 in the wp-content/plugins/h5p/h5p-php-library/h5p.classes.php file and then add a new line after them. It should look like this:

      //$zip->addFile($file->absolutePath, $file->relativePath);
      //$zip->addFile($rootPrefix . $file->absolutePath, $file->relativePath);
      $zip->addFile(realpath($file->absolutePath), $file->relativePath);

Save the file and then try to edit and save some content. Check if the error still appears – if I'm correct it should be gone :-)

Hi!

That fix worked fine! No more errors! Thx so much! 

Regards,

Douwe

Hello! I can confirm the fix you've suggested aboce has worked and the error message has been removed.

We are using multisite and H5P is network activated, I'm not sure if this has anything to do with it.

Thanks for the swift reply! This has saved a lot of stress from the academics.

Alex

icc's picture

That's great to hear! I'll do some more testing and then get out a new version of the plugin including this fix. Thanks for the testing and the quick response!

Technical note; The issue was caused by the export not having any files added to it. I believe this is because the document root path provided by the web server was used when adding the files. Replacing this with PHP's realpath() solves the issue. 
The document root variable may have been incorrect or contained rewrites to non-existent paths.

Miki's picture

Hello good people behind h5p :) !
I have been using your h5p wordpress plugin for more than a year now, it was really great! Fast and reliable no issues.

However I lost my cool after several attempts to move my h5p website to new hosting. (Actually same hosting just different account)

I couldn't get wordpress to work after several attempts of migration.
Than I decided to do a fresh install and say goodbay to the old site, when I installed h5p plugin (latest version 1.11 or something) this error appars:  /home4/cpaneluser/demo.mysite.com/wp-content/plugins/h5p/h5p-php-library/h5p-default-storage.class.php on line 214

Than i tried 1.9.4 (I didn't update intentionally due to my needs, i only updated after a certain project is complted) and got the same error.

Please help, the above code is not to be found, i only have this on line 1612 which looks same as the aformentioned solution. :(

  foreach ($files as $file) {
      // Please note that the zip format has no concept of folders, we must
      // use forward slashes to separate our directories.
      if (file_exists(realpath($file->absolutePath))) {
        $zip->addFile($file->absolutePath, $file->relativePath);
        $zip->addFile($rootPrefix . $file->absolutePath, $file->relativePath);
      }
    }

Plase help, i have been using h5p for so long, i need to get to my content :(

Thank you!

Miki's picture

When I do latest plugin install to the fresh (no other plugins) wordpress I get this error:
/home4/cpaneluser/demo.mysite.com/wp-content/plugins/h5p/h5p-php-library/h5p.classes.php on line 3887

When I delete that and install 1.9.4 version (from my old website where it worked) i get this message:
/home4/cpaneluser/demo.mysite.com/wp-content/plugins/h5p/h5p-php-library/h5p-default-storage.class.php on line 214

Miki's picture

Hello !

I just wanted to let you know that I have solved the issue.
I tried to install wp + h5p on a different hosting and all went smoothly

So I have contacted my hosting tech support and they updated the PHP on a server.

Now all works! Thanks anyway!

I hope this will help to people having the same issue.

BV52's picture

Hi Miki,

Sorry for the late response. I'm glad you found the solution and thank you for getting back to us.

-BV52

Miki's picture

I am glad it's solved, and it's actually due to my hosting.

can anyone please tell me what is wrong here 

BV52's picture

Hi,

There could be several different reasons that could be causing this issue. In order to give your report the best chance of getting answered, please include the following information:

  1. Detailed steps to reproduce the bug (exactly how and when did it happen)
  2. Platform and version number. E.g. Drupal, Wordpress, Moodle.
  3. Mobile or Desktop
  4. Browser: Chrome, Firefox, Safari etc
  5. H5P plugin version
  6. H5P content type and version (if a content type was used), and a sample URL or attached H5P.
  7. Any browser console errors
  8. Any PHP errors
  9. Screenshots if it's a visual problem
  10. Any recent changes to the environment (new plugins/modules, updates, configuration changes etc.)
  11. Any recent changes to the browser you're using (new extensions, updates etc.)

The more information you provide, the quicker the community will be able to fix it and the quicker you'll have a working solution!

-BV52