H5P activities preventing course backup - error 500


I have a site where H5P has been installed and has run without problems for around 6 months. However, we then started to experiences problems with not being able to backup courses. The only installations to the system was the addition of the checklist plugin which on other sites has not resulted in problems with H5P. It took a while to workout that H5P was the culprit. If I delete all H5P activities from a course it then backsup without problems.

There are 3 symptoms relating to H5P that may shed light on what might be causing the problem:

  1. Interactive video and Branching tools partially load and shows the error: [field:group:branchingScenario:branchingScenario]
    Presentation and other tools work fine. Directory permissions for hvp are 755.
  2. On all H5P tools the Reuse content link downloads fine but when you upload the resulting file it shows the error: 
    Validating h5p package failed. Could not find library.json file with valid json format for library H5P.IVHotspot-1.
    This error replicates on other sites where H5P is working as expected.
  3. The H5P library Plugins> Activity Modules > H5P Libraries lists and shows all the types. Hub is ticked in the settings.
    Site admin > H5P > Manage content types lists nothing even after content type is loaded and cache is refreshed.

This is a hosted site so I have limited access to http config files etc. However the provider has compared the server config files to some of my other hosted instances and they see no differences in the files.
The error log files only register a time out without further detail and result in an internal 500 error message.
I have tried automated backups with cron but no backups are created.
I have upgraded the site from 3.7 to 3.8.2  including upgrading all plugins, but the problem persists.
I have run Check on the database and all tables are OK.

I would be grateful for any ideas that might resolve this. I have 5 other Moodle instances of the identical software and plugin configurations running with the same hosting service and these are all running as expected. My gut instinct is that it may be some issue in the moodledata folder, but this folder  and how it relates to the system data is is not entirely clear to me yet.




Did you ever solve???

On my 3.9, Course Backups work - except when they have a H5P, even a tiny accordion with 2 paragraphs of text 

If I untick this H5P - backups work after 3 seconds.

If I include the H5P, backup fails after 5/6 mins and produce an Internal Server Error. (Logs say request: "POST /backup/backup.php") execution timed out (347.384174 sec), terminating

[15-Sep-2021 09:06:52] WARNING: [pool www] child 3753876 exited on signal 15 (SIGTERM) after 371.701376 seconds from start)

Another weirdness, the first backup attempt often works, even with H5P - but subsequent ones fail.

Timeouts, maxfile, ownership/permissions all checked. Would love any suggestions!! Really stuck :( 






Hi Andrew

Issue resolved when I upgraded to Moodle 3.10. I also had the random first backup works issue - it seemed to be an erratic error making it difficult to pinpoint. The upgrade to 3.10 is painless unless you have manual coding or plugins that are not compatible, I was really worried of the upgrade going sideways and losing unbackedup courses but I was in a corner and had to run the upgrade.

Maybe try clearing your caches and running the cron script to clean temp files and see if you have any luck backing up thereafter. Also check that you have the latest plugin of H5P installed. Prior to the upgrade I increased the server execution time which seemed to improve the chances of the backup executing properly.


wonderful Mike! Thanks for taking the time to answer and for your task-specific suggestions!!
OK - we will try 3.10, execution times and running the cron script (we usually delete all moodlecache and also add the (in)famous: $CFG->mod_hvp_aggregate_assets = '0'; to config.php

Thanks Mike!!

Just for completeness - unfortunately ...

Using 3.10, the fixes above, moodlecache files all deleted and H5P fully updated - the same problem persists - ie any courses with H5P content fail to backup and return an Internal Server Error.

We suspect that it might be the fact that we are on Azure (things like: the Azure RDS mis-reports the MariaDB version (now hardcoded as workaround)) . When we use a local MariaDB server - course backups with H5P work fine. So it's something related to database communication - but if this is a symptom or cause, I'm struggling to determine.


A h5p libraries file is created even with the config.php sets the forced plugin settings to disable h5p library backups.

moodledata/temp/backup/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/activities/h vp_libraries.xml


I'm surprised that the h5p seems to be ignoring the forced plugin settings. Any Ideas?

Could it be a problem with the settings, or some bug in the source?