{"id":1279,"date":"2020-05-15T14:52:37","date_gmt":"2020-05-15T14:52:37","guid":{"rendered":"https:\/\/blog.hostinger.io\/support\/2020\/05\/15\/4047803-how-to-change-the-php-version-for-subfolders-or-subdomains-in-hostinger\/"},"modified":"2026-04-08T03:07:07","modified_gmt":"2026-04-08T03:07:07","slug":"4047803-how-to-change-the-php-version-for-subfolders-or-subdomains-in-hostinger","status":"publish","type":"post","link":"https:\/\/www.hostinger.com\/support\/4047803-how-to-change-the-php-version-for-subfolders-or-subdomains-in-hostinger\/","title":{"rendered":"How to Change the PHP Version for Subfolders or Subdomains in Hostinger"},"content":{"rendered":"<p class=\"no-margin\">You can <a class=\"intercom-content-link\" href=\"\/support\/1575755-how-can-i-change-my-php-version\" target=\"_blank\" rel=\"noopener\">update the PHP version<\/a> applicable to your hosting plan directly in hPanel.<\/p><p class=\"no-margin\">If you&rsquo;d like to change the PHP version for a specific domain, subdomain, or subfolder, you can do so by adding a line of code to the .htaccess file, as explained below &#128071;<\/p><h2 id=\"h_111ebef933\">Step 1 &ndash; Open the .htaccess file<\/h2><p class=\"no-margin\">Go to <b><a class=\"intercom-content-link\" href=\"https:\/\/hpanel.hostinger.com\/websites\" target=\"_blank\" rel=\"noopener\">Websites<\/a> <\/b>&rarr;<b> Dashboard<\/b>, search for <b>File Manager <\/b>on the sidebar, and click on it:<\/p><div class=\"intercom-container intercom-align-center\"><img decoding=\"async\" src=\"\/support\/wp-content\/uploads\/sites\/55\/2020\/05\/24bf065d-e27b-4534-8531-bf7775f7210a.jpg\" width=\"250\"><\/div><p class=\"no-margin\">Then, access the <b>folder <\/b>to which you would like to apply a different PHP version:<\/p><ul>\n<li>\n<p class=\"no-margin\">If you want to edit a <b>domain<\/b>, access its <b>public_html<\/b> folder.<\/p>\n<\/li>\n<li>\n<p class=\"no-margin\">For a <b>subdomain<\/b>, the corresponding folder will be inside the domain&rsquo;s <b>public_html<\/b> folder:<\/p>\n<\/li>\n<\/ul><div class=\"intercom-container intercom-align-center\"><img decoding=\"async\" src=\"https:\/\/blog.hostinger.io\/pt\/support\/wp-content\/uploads\/sites\/59\/2022\/10\/4ee60b5c-4f2e-4003-870a-b0a41b5bc89c.jpg\"><\/div><p class=\"no-margin\">For a specific folder, go to the desired folder&rsquo;s path. Once in the correct location, open the .htaccess file by double-clicking on it.<\/p><p class=\"no-margin\">If the .htaccess file doesn&rsquo;t exist, you can <a class=\"intercom-content-link\" href=\"\/support\/1583307-how-to-create-an-htaccess-file\" target=\"_blank\" rel=\"noopener\">create it<\/a> directly in the file manager. Make sure to include a dot (.) at the beginning of the filename:<\/p><div class=\"intercom-container\"><img decoding=\"async\" src=\"https:\/\/blog.hostinger.io\/pt\/support\/wp-content\/uploads\/sites\/59\/2022\/10\/605df9c5-a37a-4d5b-a0b6-b3bd481e268f.jpg\"><\/div><h2 id=\"h_4203d73c4b\">Step 2 &ndash; Edit the .htaccess file<\/h2><p class=\"no-margin\">Add the following code to the very beginning of your .htaccess file:<\/p><pre><code>&lt;FilesMatch \".(php4|php5|php3|php2|php|phtml)$\"&gt;\r\nSetHandler application\/x-lsphp74\r\n&lt;\/FilesMatch&gt;<\/code><\/pre><p class=\"no-margin\">Make sure to replace the <code>application\/x-lsphp74<\/code> portion of the code with the version that you would like to use. Check this table for the possible values:<\/p><div class=\"intercom-interblocks-table-container\">\n<table style=\"border-collapse: collapse;width: max-content;max-width: 100%\">\n<tbody>\n<tr style=\"background-color: #e3e7fa\">\n<td><b>PHP version<\/b><\/td>\n<td><b>Code<\/b><\/td>\n<\/tr>\n<tr>\n<td>7.3<\/td>\n<td>application\/x-lsphp73<\/td>\n<\/tr>\n<tr>\n<td>7.4<\/td>\n<td>application\/x-lsphp74<\/td>\n<\/tr>\n<tr>\n<td>8.0<\/td>\n<td>application\/x-lsphp80<\/td>\n<\/tr>\n<tr>\n<td>8.1<\/td>\n<td>application\/x-lsphp81<\/td>\n<\/tr>\n<tr>\n<td>8.2<\/td>\n<td>application\/x-lsphp82<\/td>\n<\/tr>\n<tr>\n<td>8.3<\/td>\n<td>application\/x-lsphp83<\/td>\n<\/tr>\n<tr>\n<td>8.4<\/td>\n<td>application\/x-lsphp84<\/td>\n<\/tr>\n<tr>\n<td>8.5<\/td>\n<td>application\/x-lsphp85<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div><div class=\"intercom-interblocks-callout\" style=\"background-color: #e3e7fa80;border-color: #334bfa33\">\n<p class=\"no-margin\">It is recommended to use only PHP version 8.2 or higher. Lower versions are deprecated and can generate <b>security risks<\/b> and performance issues on your website.<\/p>\n<\/div><p class=\"no-margin\"><b>NOTES<\/b><\/p><ul>\n<li>\n<p class=\"no-margin\">To check if the change was applied correctly, you can <a class=\"intercom-content-link\" href=\"\/support\/5920192#h_d55e86c91b\" target=\"_blank\" rel=\"noopener\">create a phpinfo.php file<\/a>.<\/p>\n<\/li>\n<li>\n<p class=\"no-margin\">Using this method to change the PHP versions will not include PHP extensions and options.<\/p>\n<\/li>\n<li>\n<p class=\"no-margin\">Using the <code>php -v<\/code> command on <a class=\"intercom-content-link\" href=\"\/support\/1583245-how-to-connect-to-a-hosting-plan-via-ssh\" target=\"_blank\" rel=\"noopener\">SSH<\/a> will show the PHP version of the hosting plan, not the domain or subdomain.<\/p>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Setting a specific PHP version for a specific websites, subfolders or subdomains<\/p>\n","protected":false},"author":581,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"include_on_kodee":true,"footnotes":""},"categories":[234],"tags":[],"class_list":["post-1279","post","type-post","status-publish","format-standard","hentry","category-php-versions"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/support\/4047803-how-to-change-the-php-version-for-subfolders-or-subdomains-in-hostinger\/","default":1},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/support\/4047803-como-cambiar-la-version-php-de-subdirectorios-o-subdominios-en-hostinger\/","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/support\/4047803-comment-changer-la-version-de-php-pour-les-sous-dossiers-ou-les-sous-domaines-chez-hostinger\/","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/support\/4047803-cara-mengubah-versi-php-untuk-subfolder-atau-subdomain-di-hostinger\/","default":0},{"locale":"lt-LT","link":"https:\/\/www.hostinger.com\/lt\/support\/4047803-kaip-pakeisti-pakatalogiu-arba-subdomenu-php-versija-hostinger-platformoje\/","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/br\/support\/4047803-como-alterar-a-versao-do-php-para-subpastas-ou-subdominios-na-hostinger\/","default":0},{"locale":"uk-UA","link":"https:\/\/www.hostinger.com\/ua\/support\/4047803---php----\/","default":0}],"include_on_kodee":true,"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1279","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/users\/581"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/comments?post=1279"}],"version-history":[{"count":9,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1279\/revisions"}],"predecessor-version":[{"id":9490,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1279\/revisions\/9490"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/media?parent=1279"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/categories?post=1279"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/tags?post=1279"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}