{"id":655,"date":"2017-02-11T10:03:54","date_gmt":"2017-02-11T10:03:54","guid":{"rendered":"https:\/\/wickedrobot.dev\/support\/?p=655"},"modified":"2025-10-08T06:14:40","modified_gmt":"2025-10-08T06:14:40","slug":"how-to-set-the-php-version-per-directory-in-cpanel","status":"publish","type":"epkb_post_type_1","link":"https:\/\/wickedrobot.dev\/knowledge-base\/how-to-set-the-php-version-per-directory-in-cpanel","title":{"rendered":"How to Set the PHP Version per Directory in cPanel"},"content":{"rendered":"<p><span style=\"font-size: medium;\">Do you want to use different PHP versions per directory? You can do this using cPanel and the dot htaccess file.<\/span><\/p>\n<p><span style=\"font-size: medium;\"><strong>1.<\/strong> Log in to your cPanel account.<\/span><\/p>\n<p><span style=\"font-size: medium;\"><strong>2.<\/strong> In the <strong>Software<\/strong> section, click on <strong>MultiPHP Manager<\/strong>.<\/span><br \/>\n<span style=\"font-size: medium;\"><img decoding=\"async\" src=\"\/img\/cpanel-multiphp-icon.gif\" \/><\/span><\/p>\n<p><span style=\"font-size: medium;\"><strong>3. <\/strong>The first thing we need to do is to get the code generated by cPanel.<\/span><\/p>\n<p><span style=\"font-size: medium;\"><strong>4.<\/strong> Scroll down to the bottom of the page. Select your domain from the left side of the screen. You can view the <strong>PHP Version<\/strong> from the drop-down menu on the right. Please, select the appropriate PHP version from it and click on <strong>Apply<\/strong>.<\/span><br \/>\n<span style=\"font-size: medium;\"><img decoding=\"async\" src=\"\/img\/cpanel-multiphp-select-domain-full.gif\" \/><\/span><\/p>\n<p><span style=\"font-size: medium;\"><strong>5. <\/strong>First, open the <code>\/public_html\/.htaccess<\/code> file in the cPanel File Manager, and you will find the code generated by cPanel. <\/span><br \/>\n<span style=\"font-size: medium;\"><img decoding=\"async\" src=\"\/img\/cpanel-multiphp-version-generated.gif\" \/><\/span><\/p>\n<p><span style=\"font-size: medium;\"><strong>6. <\/strong>After you copy the code, should you wish to set the PHP to version 8 in the directory <strong>forums<\/strong>, create a .htaccess file in the directory \/forums\/ and paste the code generated in the previous step.<\/span><\/p>\n<p><span style=\"font-size: medium;\"><strong>7.<\/strong> Congratulations, now your directory forums is using PHP 8. Should you wish to set any other directory to use the same version of PHP as well, you would only need to copy the code from the .htaccess file and paste it into that directory. <\/span><\/p>\n<p><span style=\"font-size: medium;\">Now, reset your PHP version from your primary domain. Should you wish to use a different PHP version on any directory, follow steps five and six, generate the code, copy that code from \/public_html\/.htaccess and paste it into the directory where you want to set the selected PHP version.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Do you want to use different PHP versions per directory? You can do this using cPanel and the dot htaccess file. 1. Log in to your cPanel account. 2. In the Software section, click on MultiPHP Manager. 3. The first thing we need to do is to get the code generated by cPanel. 4. Scroll &#8230; <a title=\"How to Set the PHP Version per Directory in cPanel\" class=\"read-more\" href=\"https:\/\/wickedrobot.dev\/knowledge-base\/how-to-set-the-php-version-per-directory-in-cpanel\" aria-label=\"Read more about How to Set the PHP Version per Directory in cPanel\">Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"epkb_post_type_1_category":[76],"epkb_post_type_1_tag":[],"class_list":["post-655","epkb_post_type_1","type-epkb_post_type_1","status-publish","hentry","epkb_post_type_1_category-cpanel"],"_links":{"self":[{"href":"https:\/\/wickedrobot.dev\/jipumel\/wp\/v2\/epkb_post_type_1\/655","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wickedrobot.dev\/jipumel\/wp\/v2\/epkb_post_type_1"}],"about":[{"href":"https:\/\/wickedrobot.dev\/jipumel\/wp\/v2\/types\/epkb_post_type_1"}],"author":[{"embeddable":true,"href":"https:\/\/wickedrobot.dev\/jipumel\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/wickedrobot.dev\/jipumel\/wp\/v2\/comments?post=655"}],"version-history":[{"count":0,"href":"https:\/\/wickedrobot.dev\/jipumel\/wp\/v2\/epkb_post_type_1\/655\/revisions"}],"wp:attachment":[{"href":"https:\/\/wickedrobot.dev\/jipumel\/wp\/v2\/media?parent=655"}],"wp:term":[{"taxonomy":"epkb_post_type_1_category","embeddable":true,"href":"https:\/\/wickedrobot.dev\/jipumel\/wp\/v2\/epkb_post_type_1_category?post=655"},{"taxonomy":"epkb_post_type_1_tag","embeddable":true,"href":"https:\/\/wickedrobot.dev\/jipumel\/wp\/v2\/epkb_post_type_1_tag?post=655"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}