PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. This makes it suitable for embedding small pieces of dynamic content into web pages. PHP is also the technology behind many of the world's most popular open source web applications (including WordPress, MediaWiki and Drupal). This page gives details on how to set up your webspace for use with PHP.

Using PHP

To use PHP, your scripts should have a .php extension.

PHP versions

You can choose which version of PHP your scripts are executed with via the Hosting section of the Customer Control Panel:

  • Click on the Web Settings link for your website.
  • Scroll down to the PHP Version control.

By default, PHP scripts will run using the version of PHP provided by the operating system, but you can switch to running a newer version if required.

Using a custom PHP configuration file

Occasionally it is necessary to override some of PHP's configuration parameters. This can be done by creating a custom configuration file to override the system default values.

Simply name your custom configuration file .user.ini and place it in the root directory of your website. Note that the first character of the filename is a dot.

How PHP is invoked

PHP is commonly invoked through the mod_php Apache module, but for security reasons we do not use mod_php. Instead, we use PHP-FPM, which maintains a pool of PHP workers for your user. You may occasionally come across online documentation which assumes everyone uses mod_php, and is thus not directly applicable to our configuration. Please contact support if you need any advice.

Custom PHP error pages

As all PHP requests are processed by PHP-FPM, it will generate its own error pages. These are generated and returned directly to the client, bypassing the webserver's normal error pages. This configuration will work fine for most PHP applications (e.g. WordPress) that generate their own error pages.

However, if you would like to use custom error pages with Apache's ErrorDocument directive, you will need to set these errors to be handled by the webserver. You can create a file named .custom-php-errors in the root of your website to enable this.

For example, for the site you could run touch ~/www/