{"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-11-06T03:52:37","modified_gmt":"2026-11-06T03:52:37","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\">Change the PHP version for subfolders or subdomains in Hostinger by adding a <code>SetHandler <\/code>rule to the .htaccess file in that domain, subdomain, or folder. This rule overrides your hosting plan\u2019s PHP version for that location, but it doesn\u2019t include PHP extensions and options.<\/p>\n<h2 id=\"h_111ebef933\">Step 1 \u2013 Open the .htaccess file<\/h2>\n<p class=\"no-margin\">Go to <b><a data-click-id=\"hgr-post-content-link-websites\" class=\"intercom-content-link\" href=\"https:\/\/hpanel.hostinger.com\/websites\" target=\"_blank\" rel=\"noopener\">Websites<\/a> <\/b>\u2192<b> Manage site<\/b>, search for <b>File Manager <\/b>on the sidebar, and click on it:<\/p>\n<div class=\"intercom-container intercom-align-center\"><img decoding=\"async\" class=\"alignnone size-full wp-image-24637\" src=\"https:\/\/www.hostinger.com\/support\/wp-content\/uploads\/sites\/55\/2026\/11\/2026-11-05_14-17.png\" alt=\"\" width=\"263\" height=\"290\" \/><\/div>\n<p class=\"no-margin\">Then, access the <b>folder <\/b>to which you would like to apply a different PHP version:<\/p>\n<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\u2019s <b>public_html<\/b> folder.<br \/>\n<img decoding=\"async\" class=\"alignnone size-full wp-image-24725\" src=\"https:\/\/www.hostinger.com\/support\/wp-content\/uploads\/sites\/55\/2026\/11\/2026-11-06_10-51.png\" alt=\"\" width=\"321\" height=\"670\" srcset=\"https:\/\/www.hostinger.com\/support\/wp-content\/uploads\/sites\/55\/2026\/11\/2026-11-06_10-51.png 321w, https:\/\/www.hostinger.com\/support\/wp-content\/uploads\/sites\/55\/2026\/11\/2026-11-06_10-51-144x300.png 144w\" sizes=\"(max-width: 321px) 100vw, 321px\" \/><\/p>\n<\/li>\n<\/ul>\n<p class=\"no-margin\">For a specific folder, go to the desired folder\u2019s path. Once in the correct location, click the .htaccess file to open it.<\/p>\n<p class=\"no-margin\">If the .htaccess file doesn\u2019t exist, you can <a data-click-id=\"hgr-post-content-link-create-it\" class=\"intercom-content-link\" href=\"\/support\/1583307-how-to-create-an-htaccess-file-at-hostinger\/\" 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>\n<div class=\"intercom-container\"><img decoding=\"async\" class=\"alignnone size-full wp-image-24722\" src=\"https:\/\/www.hostinger.com\/support\/wp-content\/uploads\/sites\/55\/2026\/11\/2026-11-06_10-42_1.png\" alt=\"\" width=\"331\" height=\"176\" srcset=\"https:\/\/www.hostinger.com\/support\/wp-content\/uploads\/sites\/55\/2026\/11\/2026-11-06_10-42_1.png 331w, https:\/\/www.hostinger.com\/support\/wp-content\/uploads\/sites\/55\/2026\/11\/2026-11-06_10-42_1-300x160.png 300w\" sizes=\"(max-width: 331px) 100vw, 331px\" \/><\/div>\n<h2 id=\"h_4203d73c4b\">Step 2 \u2013 Edit the .htaccess file<\/h2>\n<p class=\"no-margin\">Add the following code to the very beginning of your .htaccess file:<\/p>\n<pre><code>&lt;FilesMatch \".(php4|php5|php3|php2|php|phtml)$\"&gt;\r\nSetHandler application\/x-lsphp74\r\n&lt;\/FilesMatch&gt;<\/code><\/pre>\n<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>\n<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>\n<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>\n<p>Your domain, subdomain, or subfolder now runs the PHP version set in its .htaccess file. To change the PHP version for your entire hosting plan instead, see <a data-click-id=\"hgr-post-content-link-how-to-change-the-php-version-of-your-hostinger-hosting-plan\" href=\"\/support\/1575755-how-to-change-the-php-version-of-your-hostinger-hosting-plan\/\">How to change the PHP version of your Hostinger hosting plan<\/a>.<\/p>\n<p class=\"no-margin\"><b>NOTES<\/b><\/p>\n<ul>\n<li>\n<p class=\"no-margin\">To check if the change was applied correctly, you can <a data-click-id=\"hgr-post-content-link-create-a-phpinfo-php-file\" class=\"intercom-content-link\" href=\"\/support\/5920192-how-to-check-the-php-version-in-hostinger\/#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 data-click-id=\"hgr-post-content-link-ssh\" class=\"intercom-content-link\" href=\"\/support\/1583245-how-to-connect-to-a-hosting-plan-via-ssh-in-hostinger\/\" 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>Change the PHP version for subfolders or subdomains in Hostinger by adding a SetHandler rule to the folder\u2019s .htaccess file.<\/p>\n","protected":false},"author":581,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_content_updated_date":"","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-BR","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-\u044f\u043a-\u0437\u043c\u0456\u043d\u0438\u0442\u0438-php-\u0432\u0435\u0440\u0441\u0456\u044e-\u043f\u0456\u0434\u043f\u0430\u043f\u043a\u0438-\u0430\u0431\u043e-\u043f\u0456\u0434\u0434","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":14,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1279\/revisions"}],"predecessor-version":[{"id":24726,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1279\/revisions\/24726"}],"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}]}}