{"id":16540,"date":"2021-03-23T17:32:33","date_gmt":"2021-03-23T17:32:33","guid":{"rendered":"https:\/\/supporthost.com\/?post_type=tutorial&#038;p=16540"},"modified":"2024-06-04T10:11:29","modified_gmt":"2024-06-04T10:11:29","slug":"php-version","status":"publish","type":"tutorial","link":"https:\/\/supporthost.com\/tutorial\/php-version\/","title":{"rendered":"How to change the PHP version"},"content":{"rendered":"\n<p>Let&#8217;s see how you can change the PHP version from cPanel with a few simple steps.<\/p>\n\n\n\n<p>From cPanel, it is possible to change the PHP version by setting one version for the whole site, or you can also set a different version for each folder or subdomain. We will look at these three methods, but first, let&#8217;s see where to find information about the current PHP version.<\/p>\n\n\n\n<p>After <a aria-label=\"logging in to cPanel (opens in a new tab)\" href=\"https:\/\/supporthost.com\/tutorial\/cpanel-login\/\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"rank-math-link\">logging in to cPanel<\/a>, click on Server Info from the right-side panel on the cPanel main page to check the current PHP version, where it says Server information.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"387\" src=\"https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/server-information-1024x387.png\" alt=\"Server Information\" class=\"wp-image-16542\" srcset=\"https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/server-information-1024x387.png 1024w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/server-information-300x114.png 300w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/server-information-768x291.png 768w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/server-information-120x45.png 120w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/server-information.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>On the next page, along with other server information, such as the Kernel version or your IP address, you will also see the PHP version.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"743\" src=\"https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/php-version-1024x743.png\" alt=\"Php Version\" class=\"wp-image-16543\" srcset=\"https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/php-version-1024x743.png 1024w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/php-version-300x218.png 300w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/php-version-768x557.png 768w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/php-version-87x63.png 87w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/php-version.png 1071w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Change the PHP version<\/h2>\n\n\n\n<p>To change the PHP version, you need to access the cPanel and scroll down to the Software section. From here, you will have to click on Select PHP Version, as you see indicated in this screen:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"240\" src=\"https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/select-php-version-1024x240.png\" alt=\"Select Php Version\" class=\"wp-image-16544\" srcset=\"https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/select-php-version-1024x240.png 1024w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/select-php-version-300x70.png 300w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/select-php-version-768x180.png 768w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/select-php-version-120x28.png 120w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/select-php-version.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>In the next screen, click on the drop-down menu next to the Current PHP version and choose the version you want.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"807\" src=\"https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/php-selector-1024x807.png\" alt=\"Php Selector\" class=\"wp-image-16545\" srcset=\"https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/php-selector-1024x807.png 1024w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/php-selector-300x236.png 300w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/php-selector-768x605.png 768w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/php-selector-80x63.png 80w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/php-selector.png 1119w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>After that, you will need to click on Set as current.<\/p>\n\n\n\n<p>From the PHP Selector, by clicking on the Extensions tab, you can also manage the extensions to activate or deactivate the different available <a href=\"https:\/\/www.php.net\/\" target=\"_blank\" aria-label=\"PHP (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"rank-math-link\">PHP<\/a> modules.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"582\" src=\"https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/php-extensions-1024x582.png\" alt=\"Php Extensions\" class=\"wp-image-16546\" srcset=\"https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/php-extensions-1024x582.png 1024w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/php-extensions-300x171.png 300w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/php-extensions-768x437.png 768w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/php-extensions-111x63.png 111w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/php-extensions.png 1177w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>From the Options tab, on the other hand, you can access several parameters that can be managed, for example, by changing the memory limit or setting a maximum limit for the uploaded files. From here it is also possible to enable the display_errors option to display <a href=\"https:\/\/supporthost.com\/php-errors\/\">PHP errors<\/a> on the screen.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"731\" height=\"605\" src=\"https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/php-options.png\" alt=\"Php Options\" class=\"wp-image-16547\" srcset=\"https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/php-options.png 731w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/php-options-300x248.png 300w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/php-options-76x63.png 76w\" sizes=\"auto, (max-width: 731px) 100vw, 731px\" \/><\/figure>\n\n\n\n<div class=\"wp-block-group is-layout-flow wp-block-group-is-layout-flow\">\n<h2 class=\"wp-block-heading\">Use the MultiPHP Manager<\/h2>\n\n\n\n<p>In fact, from the MultiPHP Manager, you can set a different PHP version for each domain (or subdomain).<\/p>\n\n\n\n<p>The MultiPHP Manager tool is located in the Software section of the cPanel. After opening it, you will find yourself in front of the list of domains associated with your account.<\/p>\n\n\n\n<p>Select the subdomain, as in our example, (or the domain) for which you want to change the PHP version by checking the box next to it:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"280\" src=\"https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/select-php-version-per-domain-1024x280.png\" alt=\"Select Php Version Per Domain\" class=\"wp-image-16550\" srcset=\"https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/select-php-version-per-domain-1024x280.png 1024w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/select-php-version-per-domain-300x82.png 300w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/select-php-version-per-domain-768x210.png 768w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/select-php-version-per-domain-120x33.png 120w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/select-php-version-per-domain.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Then from the drop-down menu beside the PHP version, select the version and click the Apply button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"466\" src=\"https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/set-php-version-1024x466.png\" alt=\"Set Php Version\" class=\"wp-image-16551\" srcset=\"https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/set-php-version-1024x466.png 1024w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/set-php-version-300x137.png 300w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/set-php-version-768x349.png 768w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/set-php-version-120x55.png 120w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/set-php-version.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>If you have created a site staging environment on a subdomain or have a multidomain account, you can choose to set up different PHP versions with a tool in cPanel.<\/p>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Change the PHP version for a folder using .htaccess<\/h2>\n\n\n\n<p>It is also possible to set different PHP versions by folder. You might need it if you require to use a script that needs a different PHP versions.<\/p>\n\n\n\n<p>To do this, we can use the .htaccess file.<\/p>\n\n\n\n<p>The first thing to do is to access the folder you are interested in. You can do this from the cPanel <a href=\"https:\/\/supporthost.com\/tutorial\/file-manager\/\" target=\"_blank\" aria-label=\"file manager (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"rank-math-link\">file manager<\/a> or by connecting via <a href=\"https:\/\/supporthost.com\/tutorial\/ftp-account\/\" class=\"rank-math-link\">FTP<\/a>.<\/p>\n\n\n\n<p>If there is no .htaccess file inside the folder yet, you will need to create one first. Otherwise, you must edit the existing one.<\/p>\n\n\n\n<p>Remember that the .htaccess file is not visible, and to see hidden files you will need to modify the settings. Just click on Settings at the top right of the cPanel and then check the item Show hidden files (dotfiles).<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"642\" height=\"439\" src=\"https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/show-hidden-files.png\" alt=\"Show Hidden Files\" class=\"wp-image-16548\" srcset=\"https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/show-hidden-files.png 642w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/show-hidden-files-300x205.png 300w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/show-hidden-files-92x63.png 92w\" sizes=\"auto, (max-width: 642px) 100vw, 642px\" \/><\/figure>\n\n\n\n<p>If you need to create the file, just click on File, and then enter the .htaccess file name in the field as you see in this screen:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"662\" height=\"332\" src=\"https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/create-htaccess-file.png\" alt=\"Create Htaccess File\" class=\"wp-image-16549\" srcset=\"https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/create-htaccess-file.png 662w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/create-htaccess-file-300x150.png 300w, https:\/\/supporthost.com\/wp-content\/uploads\/2021\/03\/create-htaccess-file-120x60.png 120w\" sizes=\"auto, (max-width: 662px) 100vw, 662px\" \/><\/figure>\n\n\n\n<p>After creating it, you can edit the file by right-clicking on it and then on Edit.<\/p>\n\n\n\n<p>The file editor will then open where you can enter these instructions to set a specific PHP version. In our example, we set the PHP 5.4 version in a single folder by adding this code in the .htaccess file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;IfModule mime_module&gt;\n  AddHandler application\/x-httpd-alt-php54 .php .php5 .phtml\n&lt;\/IfModule&gt;<\/code><\/pre>\n\n\n\n<p>You can use this method for any PHP version you want to use. Change the middle line to one of these according to the version you want to use.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table data-mtr-unique-id=\"1974526fc941deb51229fc07a717a81e-1\" class=\"mtr-table mtr-thead-th\"><thead><tr><th data-mtr-content=\" PHP version\" class=\"mtr-th-tag\"><div class=\"mtr-cell-content\"> PHP version<\/div><\/th><th class=\"has-text-align-center mtr-th-tag\" data-align=\"center\" data-mtr-content=\"\"><div class=\"mtr-cell-content\"><\/div><\/th><\/tr><\/thead><tbody><tr><td data-mtr-content=\" PHP version\" class=\"mtr-td-tag\"><div class=\"mtr-cell-content\">PHP 4.4<\/div><\/td><td class=\"has-text-align-center mtr-td-tag\" data-align=\"center\" data-mtr-content=\"\"><div class=\"mtr-cell-content\">AddHandler application\/x-httpd-alt-php44 .php .php4 .phtml<\/div><\/td><\/tr><tr><td data-mtr-content=\" PHP version\" class=\"mtr-td-tag\"><div class=\"mtr-cell-content\">PHP 5.1<\/div><\/td><td class=\"has-text-align-center mtr-td-tag\" data-align=\"center\" data-mtr-content=\"\"><div class=\"mtr-cell-content\">AddHandler application\/x-httpd-alt-php51 .php .php5 .phtml<\/div><\/td><\/tr><tr><td data-mtr-content=\" PHP version\" class=\"mtr-td-tag\"><div class=\"mtr-cell-content\">PHP 5.2<\/div><\/td><td class=\"has-text-align-center mtr-td-tag\" data-align=\"center\" data-mtr-content=\"\"><div class=\"mtr-cell-content\">AddHandler application\/x-httpd-alt-php52 .php .php5 .phtml<\/div><\/td><\/tr><tr><td data-mtr-content=\" PHP version\" class=\"mtr-td-tag\"><div class=\"mtr-cell-content\">PHP 5.3<\/div><\/td><td class=\"has-text-align-center mtr-td-tag\" data-align=\"center\" data-mtr-content=\"\"><div class=\"mtr-cell-content\">AddHandler application\/x-httpd-alt-php53 .php .php5 .phtml<\/div><\/td><\/tr><tr><td data-mtr-content=\" PHP version\" class=\"mtr-td-tag\"><div class=\"mtr-cell-content\">PHP 5.4<\/div><\/td><td class=\"has-text-align-center mtr-td-tag\" data-align=\"center\" data-mtr-content=\"\"><div class=\"mtr-cell-content\">AddHandler application\/x-httpd-alt-php54 .php .php5 .phtml<\/div><\/td><\/tr><tr><td data-mtr-content=\" PHP version\" class=\"mtr-td-tag\"><div class=\"mtr-cell-content\">PHP 5.5<\/div><\/td><td class=\"has-text-align-center mtr-td-tag\" data-align=\"center\" data-mtr-content=\"\"><div class=\"mtr-cell-content\">AddHandler application\/x-httpd-alt-php55 .php .php5 .phtml<\/div><\/td><\/tr><tr><td data-mtr-content=\" PHP version\" class=\"mtr-td-tag\"><div class=\"mtr-cell-content\">PHP 5.6<\/div><\/td><td class=\"has-text-align-center mtr-td-tag\" data-align=\"center\" data-mtr-content=\"\"><div class=\"mtr-cell-content\">AddHandler application\/x-httpd-alt-php56 .php .php5 .phtml<\/div><\/td><\/tr><tr><td data-mtr-content=\" PHP version\" class=\"mtr-td-tag\"><div class=\"mtr-cell-content\">PHP 7.0<\/div><\/td><td class=\"has-text-align-center mtr-td-tag\" data-align=\"center\" data-mtr-content=\"\"><div class=\"mtr-cell-content\">AddHandler application\/x-httpd-alt-php70 .php .php7 .phtml<\/div><\/td><\/tr><tr><td data-mtr-content=\" PHP version\" class=\"mtr-td-tag\"><div class=\"mtr-cell-content\">PHP 7.1<\/div><\/td><td class=\"has-text-align-center mtr-td-tag\" data-align=\"center\" data-mtr-content=\"\"><div class=\"mtr-cell-content\">AddHandler application\/x-httpd-alt-php71 .php .php7 .phtml<\/div><\/td><\/tr><tr><td data-mtr-content=\" PHP version\" class=\"mtr-td-tag\"><div class=\"mtr-cell-content\">PHP 7.2<\/div><\/td><td class=\"has-text-align-center mtr-td-tag\" data-align=\"center\" data-mtr-content=\"\"><div class=\"mtr-cell-content\">AddHandler application\/x-httpd-alt-php72 .php .php7 .phtml<\/div><\/td><\/tr><tr><td data-mtr-content=\" PHP version\" class=\"mtr-td-tag\"><div class=\"mtr-cell-content\">PHP 7.3<\/div><\/td><td class=\"has-text-align-center mtr-td-tag\" data-align=\"center\" data-mtr-content=\"\"><div class=\"mtr-cell-content\">AddHandler application\/x-httpd-alt-php73 .php .php7 .phtml<\/div><\/td><\/tr><tr><td data-mtr-content=\" PHP version\" class=\"mtr-td-tag\"><div class=\"mtr-cell-content\">PHP 7.4<\/div><\/td><td class=\"has-text-align-center mtr-td-tag\" data-align=\"center\" data-mtr-content=\"\"><div class=\"mtr-cell-content\">AddHandler application\/x-httpd-alt-php74 .php .php7 .phtml<\/div><\/td><\/tr><tr><td data-mtr-content=\" PHP version\" class=\"mtr-td-tag\"><div class=\"mtr-cell-content\">PHP 8.0<\/div><\/td><td class=\"has-text-align-center mtr-td-tag\" data-align=\"center\" data-mtr-content=\"\"><div class=\"mtr-cell-content\">AddHandler application\/x-httpd-alt-php80 .php .php8 .phtml<\/div><\/td><\/tr><tr><td data-mtr-content=\" PHP version\" class=\"mtr-td-tag\"><div class=\"mtr-cell-content\"> PHP 8.01<\/div><\/td><td class=\"has-text-align-center mtr-td-tag\" data-align=\"center\" data-mtr-content=\"\"><div class=\"mtr-cell-content\"> AddHandler application\/x-httpd-alt-php81 .php .php8 .phtml <\/div><\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"author":1,"featured_media":43870,"template":"","tutorial-cat":[8],"class_list":["post-16540","tutorial","type-tutorial","status-publish","has-post-thumbnail","hentry","tutorial-cat-cpanel"],"acf":[],"_links":{"self":[{"href":"https:\/\/supporthost.com\/wp-json\/wp\/v2\/tutorial\/16540","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/supporthost.com\/wp-json\/wp\/v2\/tutorial"}],"about":[{"href":"https:\/\/supporthost.com\/wp-json\/wp\/v2\/types\/tutorial"}],"author":[{"embeddable":true,"href":"https:\/\/supporthost.com\/wp-json\/wp\/v2\/users\/1"}],"version-history":[{"count":0,"href":"https:\/\/supporthost.com\/wp-json\/wp\/v2\/tutorial\/16540\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/supporthost.com\/wp-json\/wp\/v2\/media\/43870"}],"wp:attachment":[{"href":"https:\/\/supporthost.com\/wp-json\/wp\/v2\/media?parent=16540"}],"wp:term":[{"taxonomy":"tutorial-cat","embeddable":true,"href":"https:\/\/supporthost.com\/wp-json\/wp\/v2\/tutorial-cat?post=16540"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}