{"id":3627,"date":"2020-09-07T15:01:48","date_gmt":"2020-09-07T15:01:48","guid":{"rendered":"https:\/\/chemicloud.com\/kb\/?post_type=ht_kb&#038;p=3627"},"modified":"2025-05-05T07:53:38","modified_gmt":"2025-05-05T07:53:38","slug":"set-a-different-php-version-for-an-addon-domain","status":"publish","type":"ht_kb","link":"https:\/\/chemicloud.com\/kb\/article\/set-a-different-php-version-for-an-addon-domain\/","title":{"rendered":"How to Set a Different PHP Version for an Addon Domain"},"content":{"rendered":"<p>ChemiCloud uses\u00a0<a href=\"https:\/\/chemicloud.com\/kb\/article\/what-is-cloudlinux\/\">CloudLinux<\/a>\u00a0as the OS on our servers to improve server stability. A major feature of CloudLinux is that each account can select the PHP version they want to have for their websites.<\/p>\n<p>This is super useful if you have an application that requires a specific version of PHP. However, the main disadvantage of these features is that you can&#8217;t set a different PHP version for an Addon Domain or Subdomain inside cPanel.<\/p>\n<p>While this option is not available in your cPanel, it is possible to have a different PHP version for an addon domain, subdomain, or on a per-folder basis by using handlers in your site&#8217;s .htaccess file.<\/p>\n<p>You can easily change the PHP version on your account by using one of the following handlers, according to your desired PHP version.<\/p>\n<p>The handlers for all the PHP versions we offer are:<\/p>\n<pre>AddHandler application\/x-httpd-alt-php56 .php .php7 .phtml\r\nAddHandler application\/x-httpd-alt-php70 .php .php7 .phtml\r\nAddHandler application\/x-httpd-alt-php71 .php .php7 .phtml\r\nAddHandler application\/x-httpd-alt-php72 .php .php7 .phtml\r\nAddHandler application\/x-httpd-alt-php73 .php .php7 .phtml\r\nAddHandler application\/x-httpd-alt-php74 .php .php7 .phtml\r\nAddHandler application\/x-httpd-alt-php80 .php .php8 .phtml\r\nAddHandler application\/x-httpd-alt-php81 .php .php8 .phtml\r\nAddHandler application\/x-httpd-alt-php82 .php .php8 .phtml\r\nAddHandler application\/x-httpd-alt-php83 .php .php8 .phtml\r\nAddHandler application\/x-httpd-alt-php84 .php .php8 .phtml<\/pre>\n    \t\t<div class=\"hts-messages hts-messages--info  hts-messages--withtitle hts-messages--withicon \"   >\r\n    \t\t\t<span class=\"hts-messages__title\">Need to set a global PHP version instead?<\/span>    \t\t\t    \t\t\t\t<p>\r\n    \t\t\t\t\tIf you want to set a global PHP version for all your domains inside your cPanel, you can easily do so using the <a href=\"https:\/\/chemicloud.com\/kb\/article\/change-php-version-cpanel\/\" target=\"_blank\" rel=\"noopener noreferrer\">Select PHP Version<\/a> feature in cPanel.     \t\t\t\t<\/p>\r\n    \t\t\t    \t\t\t\r\n    \t\t<\/div><!-- \/.ht-shortcodes-messages -->\r\n    \t\t\n<h2 id=\"how-to-set-php-5-6-version-for-an-addon-domain\">How to Set PHP 5.6 Version for an Addon Domain<\/h2>\n<p>Let&#8217;s have a practical example of how to set the PHP 5.6 version for one of your Addon Domains.<\/p>\n<p>.htaccess file in the desired directory or modify an existing .htaccess file where you want to have a different from default PHP version with the following handler:<\/p>\n<pre># php -- BEGIN cPanel-generated handler, do not edit\r\n# Set the \u201calt-php56\u201d package as the default \u201cPHP\u201d programming language.\r\nAddHandler application\/x-httpd-alt-php56 .php .php7 .phtml\r\n# php -- END cPanel-generated handler, do not edit<\/pre>\n<p>As a result, an addon domain, for instance, will use the PHP 5.6 version which you&#8217;ve set for it, and not the global one set for the account in the cPanel &gt; PHP Selector.<\/p>\n<h2 id=\"how-to-set-php-7-version-for-an-addon-domain\">How to Set PHP 7 Version for an Addon Domain<\/h2>\n<p>Let&#8217;s have a practical example of how to set the PHP 7 version for one of your Addon Domains.<\/p>\n<p>.htaccess file in the desired directory or modify an existing .htaccess file where you want to have a different from default PHP version with the following handler:<\/p>\n<pre># php -- BEGIN cPanel-generated handler, do not edit\r\n# Set the \u201calt-php70\u201d package as the default \u201cPHP\u201d programming language.\r\nAddHandler application\/x-httpd-alt-php70 .php .php7 .phtml\r\n# php -- END cPanel-generated handler, do not edit<\/pre>\n<p>As a result, an addon domain, for instance, will use the PHP 7 version which you&#8217;ve set for it, and not the global one set for the account in the cPanel &gt; PHP Selector.<\/p>\n<h2 id=\"how-to-set-php-7-1-version-for-an-addon-domain\">How to Set PHP 7.1 Version for an Addon Domain<\/h2>\n<p>Let&#8217;s have a practical example of how to set the PHP 7.1 version for one of your Addon Domains.<\/p>\n<p>.htaccess file in the desired directory or modify an existing .htaccess file where you want to have a different from default PHP version with the following handler:<\/p>\n<pre># php -- BEGIN cPanel-generated handler, do not edit\r\n# Set the \u201calt-php71\u201d package as the default \u201cPHP\u201d programming language.\r\nAddHandler application\/x-httpd-alt-php71 .php .php7 .phtml\r\n# php -- END cPanel-generated handler, do not edit<\/pre>\n<p>As a result, an addon domain, for instance, will use the PHP 7.1 version which you&#8217;ve set for it, and not the global one set for the account in the cPanel &gt; PHP Selector.<\/p>\n<h2 id=\"how-to-set-php-7-2-version-for-an-addon-domain\">How to Set PHP 7.2 Version for an Addon Domain<\/h2>\n<p>Let&#8217;s have a practical example of how to set the PHP 7.1 version for one of your Addon Domains.<\/p>\n<p>.htaccess file in the desired directory or modify an existing .htaccess file where you want to have a different from default PHP version with the following handler:<\/p>\n<pre># php -- BEGIN cPanel-generated handler, do not edit\r\n# Set the \u201calt-php72\u201d package as the default \u201cPHP\u201d programming language.\r\nAddHandler application\/x-httpd-alt-php72 .php .php7 .phtml\r\n# php -- END cPanel-generated handler, do not edit<\/pre>\n<p>As a result, an addon domain, for instance, will use the PHP 7.2 version which you&#8217;ve set for it, and not the global one set for the account in the cPanel &gt; PHP Selector.<\/p>\n<h2 id=\"how-to-set-php-7-3-version-for-an-addon-domain\">How to Set PHP 7.3 Version for an Addon Domain<\/h2>\n<p>Let&#8217;s have a practical example of how to set the PHP 7.3 version for one of your Addon Domains.<\/p>\n<p>.htaccess file in the desired directory or modify an existing .htaccess file where you want to have a different from default PHP version with the following handler:<\/p>\n<pre># php -- BEGIN cPanel-generated handler, do not edit\r\n# Set the \u201calt-php73\u201d package as the default \u201cPHP\u201d programming language.\r\nAddHandler application\/x-httpd-alt-php73 .php .php7 .phtml\r\n# php -- END cPanel-generated handler, do not edit<\/pre>\n<p>As a result, an addon domain, for instance, will use the PHP 7.3 version which you&#8217;ve set for it, and not the global one set for the account in the cPanel &gt; PHP Selector.<\/p>\n<h2 id=\"how-to-set-php-7-4-version-for-an-addon-domain\">How to Set PHP 7.4 Version for an Addon Domain<\/h2>\n<p>Let&#8217;s have a practical example of how to set the PHP 7.4 version for one of your Addon Domains.<\/p>\n<p>Create a .htaccess file in the desired directory or modify an existing .htaccess file where you want to have a different from default PHP version with the following handler:<\/p>\n<pre># php -- BEGIN cPanel-generated handler, do not edit\r\n# Set the \u201calt-php74\u201d package as the default \u201cPHP\u201d programming language.\r\nAddHandler application\/x-httpd-alt-php74 .php .php7 .phtml\r\n# php -- END cPanel-generated handler, do not edit<\/pre>\n<p>As a result, an addon domain, for instance, will use the PHP 7.4 version which you&#8217;ve set for it, and not the global one set for the account in the cPanel &gt; PHP Selector.<\/p>\n<h2 id=\"how-to-set-php-8-0-version-for-an-addon-domain\">How to Set PHP 8.0 Version for an Addon Domain<\/h2>\n<p>Let&#8217;s have a practical example of how to set the PHP 8.0 version for one of your Addon Domains.<\/p>\n<p>.htaccess file in the desired directory or modify an existing .htaccess file where you want to have a different from default PHP version with the following handler:<\/p>\n<pre># php -- BEGIN cPanel-generated handler, do not edit\r\n# Set the \u201calt-php80\u201d package as the default \u201cPHP\u201d programming language.\r\nAddHandler application\/x-httpd-alt-php80 .php .php8 .phtml\r\n# php -- END cPanel-generated handler, do not edit<\/pre>\n<p>As a result, an addon domain, for instance, will use the PHP 8.0 version which you&#8217;ve set for it, and not the global one set for the account in the cPanel &gt; PHP Selector.<\/p>\n<h2 id=\"how-to-set-php-8-1-version-for-an-addon-domain\">How to Set PHP 8.1 Version for an Addon Domain<\/h2>\n<p>Let&#8217;s have a practical example of how to set the PHP 8.1 version for one of your Addon Domains.<\/p>\n<p>.htaccess file in the desired directory or modify an existing .htaccess file where you want to have a different from default PHP version with the following handler:<\/p>\n<pre># php -- BEGIN cPanel-generated handler, do not edit\r\n# Set the \u201calt-php81\u201d package as the default \u201cPHP\u201d programming language.\r\nAddHandler application\/x-httpd-alt-php81 .php .php8 .phtml\r\n# php -- END cPanel-generated handler, do not edit<\/pre>\n<p>As a result, an addon domain, for instance, will use the PHP 8.1 version which you&#8217;ve set for it, and not the global one set for the account in the cPanel &gt; PHP Selector.<\/p>\n<h2 id=\"how-to-set-php-8-2-version-for-an-addon-domain\">How to Set PHP 8.2 Version for an Addon Domain<\/h2>\n<p>Let&#8217;s have a practical example of how to set the PHP 8.2 version for one of your Addon Domains.<\/p>\n<p>.htaccess file in the desired directory or modify an existing .htaccess file where you want to have a different from default PHP version with the following handler:<\/p>\n<pre># php -- BEGIN cPanel-generated handler, do not edit\r\n# Set the \u201calt-php82\u201d package as the default \u201cPHP\u201d programming language.\r\nAddHandler application\/x-httpd-alt-php81 .php .php8 .phtml\r\n# php -- END cPanel-generated handler, do not edit<\/pre>\n<p>As a result, an addon domain, for instance, will use the PHP 8.1 version which you&#8217;ve set for it, and not the global one set for the account in the cPanel &gt; PHP Selector.<\/p>\n<h2 id=\"how-to-set-php-8-3-version-for-an-addon-domain\">How to Set PHP 8.3 Version for an Addon Domain<\/h2>\n<p>Let&#8217;s have a practical example of how to set the PHP 8.3 version for one of your Addon Domains.<\/p>\n<p>.htaccess file in the desired directory or modify an existing .htaccess file where you want to have a different from default PHP version with the following handler:<\/p>\n<pre># php -- BEGIN cPanel-generated handler, do not edit\r\n# Set the \u201calt-php83\u201d package as the default \u201cPHP\u201d programming language.\r\nAddHandler application\/x-httpd-alt-php83 .php .php8 .phtml\r\n# php -- END cPanel-generated handler, do not edit<\/pre>\n<p>As a result, an addon domain, for instance, will use the PHP 8.3 version which you&#8217;ve set for it, and not the global one set for the account in the cPanel &gt; PHP Selector.<\/p>\n<h2 id=\"how-to-set-php-8-4-version-for-an-addon-domain\">How to Set PHP 8.4 Version for an Addon Domain<\/h2>\n<p>Let&#8217;s have a practical example of how to set the <strong>PHP 8.4<\/strong> version for one of your Addon Domains.<\/p>\n<p>.htaccess file in the desired directory or modify an existing .htaccess file where you want to have a different from default PHP version with the following handler:<\/p>\n<pre># php -- BEGIN cPanel-generated handler, do not edit\r\n# Set the \u201calt-php83\u201d package as the default \u201cPHP\u201d programming language.\r\nAddHandler application\/x-httpd-alt-php84 .php .php8 .phtml\r\n# php -- END cPanel-generated handler, do not edit<\/pre>\n<p>As a result, an addon domain, for instance, will use the PHP 8.4 version which you&#8217;ve set for it, and not the global one set for the account in the cPanel &gt; PHP Selector.<\/p>\n<p><strong>That&#8217;s a wrap!<\/strong><\/p>\n<p>Now you know how you can easily change the PHP version on your Addon domains by using one of the following handlers, according to your desired PHP version.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ChemiCloud uses\u00a0CloudLinux\u00a0as the OS on our servers to improve server stability. A major feature of CloudLinux is that each account can select the PHP version they want to have for their websites. This is super useful if you have an application that requires a specific version of PHP. However, the&#8230;<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"ht-kb-category":[173],"ht-kb-tag":[],"class_list":["post-3627","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-php-configuration"],"_links":{"self":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb\/3627","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/comments?post=3627"}],"version-history":[{"count":14,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb\/3627\/revisions"}],"predecessor-version":[{"id":8635,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb\/3627\/revisions\/8635"}],"wp:attachment":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/media?parent=3627"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb-category?post=3627"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb-tag?post=3627"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}