H5P Guides

Configure PHP

Independent of which platform you are planning to use, there are some configuration parameters you should consider changing before setting up H5P. These parameters are related to file upload, and the max sizes allowed by your web server.

Start by finding the php.ini in use by your web server, and open it in any text editor. When deciding how large files you will allow being uploaded, have in mind these settings is relevant both when uploading H5P-files, and when uploading other files to your site. The parameters you would like to change, are upload_max_filesize and post_max_size. In the example below, these values are set to 128MB. Note that post_max_size should always be larger or equal to upload_max_filesize.

If you set upload_max_filesize to 64M and post_max_size to 128M, this means that you can upload two files at max 64M at the same time. (in the same request)

; Maximum allowed size for uploaded files.

upload_max_filesize = 128M

; Maximum size of POST data that PHP will accept.

post_max_size = 128M

After saving the changes to php.ini, you will need to restart your web server so that it reloads the new php.ini.

Now before you go wild with these settings you should keep in mind that increasing them will make you more vulnerable to vicious Denial of Service attacks, as your server will spend more time handling requests. As of PHP 5.3.1 there's a setting called max_file_uploads that will limit the number of simultaneous uploads for all users.

If you're still having issues uploading big files after you've changed these settings, you should check your web server for a max request size limit. In nginx this will be called client_max_body_size.

PHP extensions

PHP extensions are modules that add functionality to your PHP environment. Usually the most common extensions are bundled with your PHP, so you wont have to take any action. If you find that you're missing some PHP extension, then make sure the following extensions, which H5P depends, are enabled for your environment:

  • ZipArchive (mandatory)
  • mbstring (mandatory)
  • openssl (optional)

 You can see which extensions are enabled for your PHP version by looing at the output of PHPINFO, most web CMS will provide you a way to inspect it throuhg a page, otherwise you can print it out from a PHP script or inspect your php.ini file.

Troubleshooting

 

Unable to communicate with the Hub

If you're getting this problem it is likely that something is wrong with how your server is set up for talking to H5P.org.
A common problem we see with Guzzle is that a required certificate is not present when using the https protocol.
You can usually solve this by adding a valid "cacert" to your server setup. See papi Joe's comment for more information.