Apply specific PHP versions to different domains (multi-PHP)

Definitions

PHP versions are releases of the PHP scripting language. If you host multiple domains under one hosting account, each one may require a specific PHP version.

Multi-PHP allows you to apply a specific PHP version for each domain, without modifying the PHP version of your entire hosting account.

Before you start

✅ Multi-PHP is the ability to apply a specific PHP version to a specific domain on your hosting account.

ℹ️ If you need to change the PHP version for your entire hosting account, you will need to use the global PHP setting, please follow the steps in this guide instead: Change the PHP version on your hosting account

⚠️ Changing PHP versions can break websites or apps. Make sure your plugins and themes are compatible with the PHP version you will apply. Contact their development teams if you’re unsure.

❗This guide will be updated periodically as PHP versions are decommissioned or released.

Step by step

1. Go to your domain .htaccess file, use this guide for steps: Access and modify your .htaccess file

2.  In your domain .htaccess file, place the snippet for the corresponding PHP version you want to apply on your website or app. They are provided below.

⚠️ Read these points before you start modifying your .htaccess file:

  • ➡️ Each .htaccess file has distinct and varied existing code snippets, this is normal.
  • ➡️ Put your PHP version snippet at the top of your .htaccess file. If there’s no room at the top, press ‘Enter’ or ‘Return’ on your keyboard to create space by moving the existing snippets down.
  • ➡️ The PHP version snippet needs to be on its own separate line to function properly.
  • ➡️ You need to click the Save File button at the top right of your .htaccess file to apply changes.

To provide a visual, here is an example of the PHP version 7.4 code snippet placed within an .htaccess file:

PHP version 5.6

AddType application/x-lsphp56 .php5 .php4 .php .php3 .php2 .phtml .htm .html

PHP version 7.2

AddType application/x-lsphp72 .php5 .php4 .php .php3 .php2 .phtml .htm .html

PHP version 7.4

AddType application/x-lsphp74 .php5 .php4 .php .php3 .php2 .phtml .htm .html

PHP version 8.0

AddType application/x-lsphp80 .php5 .php4 .php .php3 .php2 .phtml .htm .html

PHP version 8.1

AddType application/x-lsphp81 .php5 .php4 .php .php3 .php2 .phtml .htm .html

PHP version 8.2

AddType application/x-lsphp82 .php5 .php4 .php .php3 .php2 .phtml .htm .html

PHP version 8.3

AddType application/x-lsphp83 .php5 .php4 .php .php3 .php2 .phtml .htm .html