3.10 H5P Apache installation

3.10 H5P Apache installation

by Alexie Papanicolaou -
Number of replies: 9

Dear all

I was wondering if there is a webpage somewhere - anywhere for I failed to find one thus far - that explains how to setup 3.10's mod_h5pactivity with Apache2, php 7.4 correctly.

I deployed a fresh installation of 3.10, caught up on the differences between the core and mod_h5p, picking the former (i.e no non-core h5p modules installed).

Then I tried to do a Add activity or resource -> H5P

However I get a generic 500 error. I have no idea where to troubleshoot the error or why it doesn't work out of the box.

My php (7.4.13) has zip, mbstrings and ssl installed. Apache/2.4.46 is running on SSL 

With apache logging on debug, there are no relevant error reported or on the syslog. 

My apache config has this according to Apache - MoodleDocs:

```

<VirtualHost *:443>

.....

AcceptPathInfo On

        <Directory /var/www/html/moodle>

                AllowOverride all

        </Directory>

```

I wonder if the mod_deflate is causing issues but have no idea why it might.

Could someone please share what they have done to make it work?

Average of ratings: -
In reply to Alexie Papanicolaou

Ri: 3.10 H5P Apache installation

by Cosmo Furno Palumbo -


I also have a similar situation...  I made a Moodle 3.10.1+ installation where I saw an H5P plugin (mod_h5pactivity) identified by a blue icon; trying to add H5P content to a course I can't edit it, the server tells me to wait... but without reporting errors.

I then tried to install the mod_hvp plugin (identified by a black icon) and using it the content is added and edited without problems.

I also hypothesized that it could depend on a configuration to be corrected but I have not found anything about it; any suggestion is welcome!


In reply to Cosmo Furno Palumbo

Re: Ri: 3.10 H5P Apache installation

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
500 errors can be caused by the PHP Apache module failing, so put Moodle into 'Developer level debugging' (look up the risks first), then replicate the issue and look in the PHP error log file.
In reply to Gareth J Barnard

Ri: Re: Ri: 3.10 H5P Apache installation

by Cosmo Furno Palumbo -

I tried what you suggested and I can read this event in the PHP error log file:

[Mon Mar 08 23:30:35.166738 2021] [php7:notice] [pid 3855] [client 172.18.0.60:61200] Default exception handler: Si \xc3\xa8 verificato un errore durante la lettura del database Debug: Unknown column 'l.tutorial' in 'field list'\nSELECT l.id, l.machinename AS machine_name, l.majorversion AS major_version,\r\n                       l.minorversion AS minor_version, l.patchversion AS patch_version, l.coremajor AS h5p_major_version,\r\n                       l.coreminor AS h5p_minor_version, l.title, l.tutorial, l.example,\r\n                       '' AS summary, '' AS description, '' AS icon, 0 AS created_at, 0 AS updated_at, 0 AS is_recommended,\r\n                       0 AS popularity, '' AS screenshots, '' AS license, '' AS owner\r\n                  FROM mdl_h5p_libraries l\n[array (\n)]\nError code: dmlreadexception\n* line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown\n* line 1273 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()\n* line 95 of /h5p/classes/editor_ajax.php: call to mysqli_native_moodle_database->get_records_sql()\n* line 511 of /h5p/h5plib/v124/joubel/editor/h5peditor.class.php: call to core_h5p\\editor_ajax->getContentTypeCache()\n* line 542 of /h5p/h5plib/v124/joubel/editor/h5peditor.class.php: call to H5peditor->getUserSpecificContentTypeCache()\n* line 444 of /h5p/h5plib/v124/joubel/editor/h5peditor-ajax.class.php: call to H5peditor->getLatestGlobalLibrariesData()\n* line 106 of /h5p/h5plib/v124/joubel/editor/h5peditor-ajax.class.php: call to H5PEditorAjax->getContentTypeCache()\n* line 71 of /h5p/ajax.php: call to H5PEditorAjax->action()\n

I'm sorry but I don't understand much from what I read, except that it seems to me that there is an error reading the database; could you help me?

In reply to Cosmo Furno Palumbo

Re: Ri: Re: Ri: 3.10 H5P Apache installation

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

For some reason your upgrade to Moodle 3.10 failed / was not done correctly via 'Site Administration -> Notifications' and thus the code in '/lib/db/upgrade.php' either did not run or failed for some reason:

    if ($oldversion < 2020101300.01) {
        // Define fields tutorial and example to be added to h5p_libraries.
        $table = new xmldb_table('h5p_libraries');
        // Add tutorial field.
        $field = new xmldb_field('tutorial', XMLDB_TYPE_TEXT, null, null, null, null, null, 'metadatasettings');
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
        }
        // Add example field.
        $field = new xmldb_field('example', XMLDB_TYPE_TEXT, null, null, null, null, null, 'tutorial');
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
        }
        // Main savepoint reached.
        upgrade_main_savepoint(true, 2020101300.01);
    }

I don't know why!  But the 'tutorial' column is missing in the 'h5p_libraries' table in the database.  Talk to your site administrator.

In reply to Gareth J Barnard

Ri: Re: Ri: Re: Ri: 3.10 H5P Apache installation

by Cosmo Furno Palumbo -

I'm a newbie... and, as self-taught, the site is administered by myself! 🙄

Could I solve my self? Do you think a solution made by me is viable?

In reply to Cosmo Furno Palumbo

Re: Ri: Re: Ri: Re: Ri: 3.10 H5P Apache installation

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
I don't know what your skill level is. Possibly if you can look at the detail in '/lib/db/install.xml' and manually add in the missing column into your database with the attributes specified.
In reply to Gareth J Barnard

Ri: Re: Ri: Re: Ri: Re: Ri: 3.10 H5P Apache installation

by Cosmo Furno Palumbo -
Thank you so much for the answer and for the help.

My skill level dictates me caution... however, out of my desire to learn, I took a look at both the file '/lib/db/install.xml' and the 'h5p_libraries' table.

This is the table...
Screenshot

And this is the contents (from '/lib/db/install.xml') that I note missing...

        <FIELD NAME="tutorial" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Tutorial URL"/>
        <FIELD NAME="example" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Example URL"/>

So, if it's the true... I must manually add these missing column in the 'h5p_libraries' table. But, what are the possible risks from this action? Can I screw up the whole Moodle installation?
Otherwise, could I uninstall the single component and perform a reinstallation of it? This could be a less risky operation, isn't it?
In reply to Cosmo Furno Palumbo

Re: Ri: Re: Ri: Re: Ri: Re: Ri: 3.10 H5P Apache installation

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
Build a test installation, practice the procedure, make a backup of the real DB, make the change. If you make a mistake outside of that table, then you can muck up the whole installation. It's a core component with the DB element not within itself like a contributed plugin, so uninstall / reinstall not probably practical.
In reply to Gareth J Barnard

Ri: Re: Ri: Re: Ri: Re: Ri: Re: Ri: 3.10 H5P Apache installation

by Cosmo Furno Palumbo -

Hi Gareth.

Once again thanks for the support!

This suggested way is the most correct. And it give me the possibility to try without risk, doing experience. 😉

All the best!