H5P Guides

Troubleshooting PHP

This guide will explain how you can find all the necessary info in order to solve any server related problem you are facing.

For any error messages that appears within the H5P plugin, please visit the Troubleshooting H5P guide to see if the problem can be solved there, before moving over to this guide.

The guide consists of the following sections, make sure that you've handled a preceding section before moving on to the next:

Troubleshooting PHP extensions

A common issue users run into is that their PHP extensions are not enabled or set up correctly. If you are in full control of your own webserver you can follow along the guide below to check that all required PHP extensions are enabled. If you’re running a hosted environment please contact your hosting provider and ask them if the extensions are enabled.

Display phpinfo

Phpinfo is a page that displays information about your PHP installation. The page may contain sensitive information, so be careful with the information you find on this page. Accessing the page will vary depending on the platform you are using, so a separate guide for each system is provided below

Moodle
The phpinfo page can be accessed through “Site administration” -> “Server” -> “PHP info”, when logged in as an administrator. See Moodle's PHP guide for more information.

Wordpress
For Wordpress there is not built in phpinfo page, so you have to create your own. This can be achieved by making a file that contains the phpinfo() function, and opening that file through your webserver. File content:

<?php phpinfo(); ?>

You can learn more about this by reading Wordpress’ guide on “Finding Server Info”.

Drupal
In Drupal 7 you can find the phpinfo page under “admin/reports/status”. There you’ll see a line with PHP, and you can click on the link “more information” to show the phpinfo page. 

Check extensions

Once you have found the phpinfo page we can see which extensions are installed. Under the “Configuration” header you will find several sub-headers, your extensions will be listed among these. So, to make sure you have “ZipArchive”, “MBString” and “OpenSSL” enabled, you must look for the following subheaders in your phpinfo page:

  • zip
  • mbstring
  • openssl

 

Troubleshooting PHP error log

 If you’re not able to resolve your plugin problem through fixing your extensions or resolve the issue through the most common error messages, found in the “troubleshooting guide”, chances are that you’re experiencing a more uncommon problem. If this is a server error, which is likely if you’re experiencing empty pages, or libraries not being loaded, then the best way to track down the problem is through your error log.

Find the error log

Where your PHP error log is located can be configured differently between webservers, and errors may not even show up in the log if your platform does not wish to. In this section I will list one way to find the error logs for each platform, but be aware that there are other ways of achieving this as well.

Moodle
Moodle includes features for displaying your errors directly in the page where they happened. This is very convenient if you’re less technical, and allows you to view the errors without digging through text files and locating logs.The easiest way to enable debugging for Moodle is to go to “Site Administration” -> “Debugging” and set the debug messages to “DEVELOPER”. More details can be found on Moodle’s debugging page.

Wordpress
To enable debugging in Wordpress, there is a special flag you can set in the config. Locate your wp-config.php file, then make sure the following is set there:

define('WP_DEBUG', true);

When you have set this you should be able to see the error when it happens, directly in the browser. More details can be found on Wordpress’ debugging page.

Drupal
Unlike the other platforms, Drupal has no built in debugging mode, so for Drupal you will have to go straight to the log file to view the error. Fortunately this is not hard at all. Once you’ve found the phpinfo file from the previous extensions section you can find the location of your PHP error logs by searching for “error_log”. The value that is set for this file will be where the errors are stored. You can navigate to the log and look through it to find any errors that has been reported.

Reproducing and handling the error

When you have located the error log, you should try to reproduce the problem. Check back to see that you received the error message again, which should give you a detailed summary of the error you’re facing.

Your next steps should be to google the problem to see if anyone else has been facing the same issue and have provided a fix for it. Always try to fix it yourself first, then if you’re unable to find any similar problems and solutions post to the H5P.org forums and the community will try to help you.