{"id":536,"date":"2016-06-01T00:00:00","date_gmt":"2016-06-01T00:00:00","guid":{"rendered":"http:\/\/blog.hostinger.io\/hostinger-tutorials\/%category\/cpanelhow-to-change-your-php-version-in-cpanel\/"},"modified":"2025-12-23T05:10:07","modified_gmt":"2025-12-23T05:10:07","slug":"how-to-change-your-php-version","status":"publish","type":"post","link":"\/tutorials\/how-to-change-your-php-version","title":{"rendered":"How to change the PHP version of a website + things to consider before updating"},"content":{"rendered":"<p>Hypertext Preprocessor (PHP) is an open-source server-side scripting language widely used for web development. It is also used in popular content management systems (CMS), such as WordPress and Joomla.<\/p><p>Since PHP updates frequently, the default version installed on your web server may be outdated. Therefore, it is crucial to understand how to switch PHP versions to maintain your site&rsquo;s functionality.<\/p><p>This article will explain why and how to change your site&rsquo;s PHP version. We will also list the prerequisites and answer commonly asked questions about changing the PHP version.<\/p><p>\n\n\n\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-why-change-php-version-of-your-site\">Why Change PHP Version of Your Site<\/h2><p>As an essential part of your website, PHP defines how your web page functions. Depending on your goal, you may upgrade or downgrade to another version of PHP.<\/p><p>A PHP upgrade can bring many benefits to your site, namely:<\/p><ul class=\"wp-block-list\">\n<li><strong>Increased security<\/strong>. Due to its popularity, many <a href=\"https:\/\/cyware.com\/news\/php-abused-for-web-skimming-attacks-a326087d\" target=\"_blank\" rel=\"noopener\">cybercriminals often exploit PHP<\/a> to attack a website. Updating PHP applies the newest security patch, protecting your site.<\/li>\n\n\n\n<li><strong>Performance boost<\/strong>. The newer PHP version is faster and more efficient. According to WordPress, updating PHP can improve your site&rsquo;s speed by up to <a href=\"https:\/\/wordpress.org\/support\/update-php\/\" target=\"_blank\" rel=\"noopener\">400%<\/a>.<\/li>\n\n\n\n<li><strong>New features<\/strong>. A major PHP update usually adds new features. For instance, <a href=\"https:\/\/www.php.net\/manual\/en\/migration80.new-features.php\" target=\"_blank\" rel=\"noopener\">PHP version 8&rsquo;s new features<\/a> include named arguments, union types, and match expression features.<\/li>\n\n\n\n<li><strong>Improved functionality<\/strong>. Updating your PHP version fixes bugs that may harm your site&rsquo;s functionality. It also lets you run your updated site code properly.<\/li>\n<\/ul><p>Meanwhile, you may want to downgrade PHP to an earlier version to fix an incompatibility issue. Sometimes, newer PHP versions can&rsquo;t properly run older plugins, themes, or site codes.<\/p><h2 class=\"wp-block-heading\" id=\"h-what-to-consider-before-changing-the-php-version\">What to Consider Before Changing the PHP Version<\/h2><p>Before switching to a different PHP version, consider the following prerequisites to ensure your site works normally.<\/p><h3 class=\"wp-block-heading\" id=\"h-update-cms-to-the-newest-version\">Update CMS to the Newest Version<\/h3><p>Update your CMS before switching to a different PHP version. Since most CMS are based on PHP, an outdated version may trigger incompatibility issues. These issues may prevent PHP codes from running correctly, harming your site&rsquo;s functionality.<\/p><p>The steps to check your CMS version may vary. To <a href=\"\/tutorials\/how-to-check-which-version-of-wordpress-you-are-using\">check your current WordPress version<\/a>, log in to your site&rsquo;s <strong>wp-admin<\/strong> page and navigate to the sidebar &rarr; <strong>Dashboard &rarr; Updates<\/strong>.<\/p><figure class=\"wp-block-image aligncenter size-large\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2016\/06\/wordpress-updates-menu.png\"><img decoding=\"async\" width=\"1024\" height=\"276\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/wordpress-updates-menu.png\/public\" alt=\"The Updates button on the WordPress dashboard sidebar\n\" class=\"wp-image-73146\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/wordpress-updates-menu.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/wordpress-updates-menu.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/wordpress-updates-menu.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/wordpress-updates-menu.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><p>WordPress will display the currently active version and the newest stable release. If your WordPress is up-to-date, it will say, &ldquo;<strong>You have the latest version of WordPress.<\/strong>&rdquo;<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/02\/wordpress-dashboard-updates.png\"><img decoding=\"async\" width=\"1291\" height=\"585\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/02\/wordpress-dashboard-updates.png\/public\" alt='The \"You have the latest version of WordPress.\" message on the WordPress dashboard' class=\"wp-image-104239\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/02\/wordpress-dashboard-updates.png\/w=1291,fit=scale-down 1291w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/02\/wordpress-dashboard-updates.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/02\/wordpress-dashboard-updates.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/02\/wordpress-dashboard-updates.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/02\/wordpress-dashboard-updates.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1291px) 100vw, 1291px\" \/><\/a><\/figure><\/div><p>Otherwise, it says, &ldquo;<strong>An updated version of WordPress is available.<\/strong>&rdquo; Simply press the <strong>Update Now<\/strong> button to download and install the latest WordPress version.<\/p><h3 class=\"wp-block-heading\" id=\"h-make-sure-the-site-code-is-up-to-date\">Make Sure the Site Code Is Up-To-Date<\/h3><p>Your old site code may not execute properly if you use the latest PHP version. This also applies to PHP-based programs, such as WordPress themes and plugins.<\/p><p>To ensure your site works well, update its code, themes, and plugins before upgrading PHP.<\/p><p>There are different ways to check whether your website is compatible with a specific version of PHP. For instance, you can use Hostinger&rsquo;s <strong>WordPress and PHP compatibility checker<\/strong>. This tool examines your site&rsquo;s core and current PHP version, advising a switch to a compatible version if necessary.<\/p><p>To use the compatibility checker, access your hPanel dashboard and navigate to <strong>WordPress &rarr; Overview<\/strong>, and locate the <strong>PHP Version<\/strong> section. If you&rsquo;re using a supported PHP version, you will see the following message:<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/02\/hpanel-wordpress-overview-php-version-highlighted.png\"><img decoding=\"async\" width=\"485\" height=\"721\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/02\/hpanel-wordpress-overview-php-version-highlighted.png\/public\" alt=\"The PHP Version in hPanel shows a compatible version of PHP\" class=\"wp-image-104241\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/02\/hpanel-wordpress-overview-php-version-highlighted.png\/w=485,fit=scale-down 485w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/02\/hpanel-wordpress-overview-php-version-highlighted.png\/w=202,fit=scale-down 202w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/02\/hpanel-wordpress-overview-php-version-highlighted.png\/w=101,fit=scale-down 101w\" sizes=\"(max-width: 485px) 100vw, 485px\" \/><\/a><\/figure><\/div><p>However, you will receive a warning if your website is not compatible with your current PHP version. Click the <strong>Change<\/strong> button to update your PHP version to a supported one.<\/p><p>Alternatively, test your website with the new PHP version manually on a local development server. This option lets you check your site&rsquo;s compatibility with the new PHP version without affecting the live one.<\/p><figure class=\"wp-block-image size-full\"><a class=\"hgr-tutorials-cta hgr-tutorials-cta-web-hosting\" href=\"\/web-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\/public\" alt=\"Hostinger web hosting banner\" class=\"wp-image-98604\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h3 class=\"wp-block-heading\" id=\"h-resolve-php-errors-and-warnings\">Resolve PHP Errors and Warnings<\/h3><p>You may get PHP error messages or warnings even when your site works fine. Unfortunately, these alerts may indicate that your site code may not work with a different PHP version.<\/p><p>If you <a href=\"\/web-hosting\">host your website on Hostinger<\/a>, you can <a href=\"https:\/\/support.hostinger.com\/en\/articles\/1583197-how-to-turn-off-php-error-messages-in-hpanel\" target=\"_blank\" rel=\"noopener\">disable PHP error messages via hPanel<\/a>. However, you shouldn&rsquo;t ignore them, especially if your site encounters issues.<\/p><p>These error messages help determine PHP problems, allowing you to fix them quickly. In case of incompatibility, resolve the error by:<\/p><ul class=\"wp-block-list\">\n<li>Disable and enable themes and plugins<\/li>\n\n\n\n<li>Enable the default theme<\/li>\n\n\n\n<li>Update the site code, plugins, and themes<\/li>\n\n\n\n<li>Use the default <strong>.htaccess file<\/strong><\/li>\n<\/ul><h2 class=\"wp-block-heading\" id=\"h-how-to-change-php-version-in-hpanel\">How to Change PHP Version in hPanel<\/h2><p>The simplest way to change your system-wide version of PHP is via your hosting control panel. Aside from switching to different PHP versions, it<strong> <\/strong>lets you configure PHP extensions and options. At Hostinger, we use <a href=\"https:\/\/www.hostinger.com\/support\/1583483-comprehensive-guide-to-hpanel-at-hostinger\/\">hPanel<\/a>.<\/p><p>hPanel supports up to <strong>PHP 8.2<\/strong> and will update its support each time a new PHP version is launched. Although we will use <strong>hPanel<\/strong> in this tutorial, the following steps should be similar for other hosting control panels like <strong>cPanel<\/strong>:<\/p><ol class=\"wp-block-list\">\n<li>Log in to <strong>hPanel<\/strong> and click <strong>Hosting <\/strong>on top of the homepage.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2016\/06\/hosting-menu-in-hpanel-homepage.png\"><img decoding=\"async\" width=\"1024\" height=\"396\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/hosting-menu-in-hpanel-homepage.png\/public\" alt=\"Hosting menu in hPanel homepage\" class=\"wp-image-73148\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/hosting-menu-in-hpanel-homepage.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/hosting-menu-in-hpanel-homepage.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/hosting-menu-in-hpanel-homepage.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/hosting-menu-in-hpanel-homepage.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><ol start=\"2\" class=\"wp-block-list\">\n<li>Click the <strong>Manage <\/strong>button next to your domain name.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2016\/06\/manage-a-domain-in-hpanel.png\"><img decoding=\"async\" width=\"1024\" height=\"383\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/manage-a-domain-in-hpanel.png\/public\" alt=\"The Manage button next to the domain name on hPanel's Hosting screen\" class=\"wp-image-73149\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/manage-a-domain-in-hpanel.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/manage-a-domain-in-hpanel.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/manage-a-domain-in-hpanel.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/manage-a-domain-in-hpanel.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><ol start=\"3\" class=\"wp-block-list\">\n<li>On the sidebar, go to <strong>Advanced<\/strong> &rarr; <strong>PHP configuration<\/strong>.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-advanced-phpconfiguration-highlight.png\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-advanced-phpconfiguration-highlight.png\/public\" alt=\"PHP configuration menu in hPanel\" class=\"wp-image-79455\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-advanced-phpconfiguration-highlight.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-advanced-phpconfiguration-highlight.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-advanced-phpconfiguration-highlight.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-advanced-phpconfiguration-highlight.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><ol start=\"4\" class=\"wp-block-list\">\n<li>Select the <strong>PHP version<\/strong> you want to use. By default, it only shows supported versions, but you can check <strong>Show no longer supported PHP versions<\/strong> to display older ones.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/02\/hpanel-websites-php-configuration.png\"><img decoding=\"async\" width=\"1295\" height=\"764\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/02\/hpanel-websites-php-configuration.png\/public\" alt=\"The PHP version tab in the PHP Configuration screen on hPanel\" class=\"wp-image-104242\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/02\/hpanel-websites-php-configuration.png\/w=1295,fit=scale-down 1295w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/02\/hpanel-websites-php-configuration.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/02\/hpanel-websites-php-configuration.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/02\/hpanel-websites-php-configuration.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/02\/hpanel-websites-php-configuration.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1295px) 100vw, 1295px\" \/><\/a><\/figure><\/div><ol start=\"5\" class=\"wp-block-list\">\n<li>Click <strong>Update <\/strong>to save the changes.<\/li>\n<\/ol><h2 class=\"wp-block-heading\" id=\"h-how-to-change-php-version-for-a-specific-folder-or-a-subdomain\">How to Change PHP Version for a Specific Folder or a Subdomain<\/h2><p>You can change the PHP version for a specific folder of a subdomain by editing the <strong>.htaccess<\/strong> file. This method allows you to use multiple PHP versions on the same account.<\/p><p>In the following tutorial, we will install<strong> PHP 8.1<\/strong> for a subdomain via <strong>hPanel<\/strong>:<\/p><ol class=\"wp-block-list\">\n<li>Log in to your <strong>hPanel <\/strong>and select <strong>Hosting<\/strong>.<\/li>\n\n\n\n<li>Click <strong>Manage <\/strong>next to your desired domain.<\/li>\n\n\n\n<li>Go to <strong>Files <\/strong>&rarr; <strong>File Manager<\/strong>.<\/li>\n<\/ol><figure class=\"wp-block-image aligncenter size-large\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2016\/06\/file-manager-menu-in-hpanel.png\"><img decoding=\"async\" width=\"1024\" height=\"497\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/file-manager-menu-in-hpanel.png\/public\" alt=\"File Manager menu in hPanel\n\" class=\"wp-image-73153\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/file-manager-menu-in-hpanel.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/file-manager-menu-in-hpanel.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/file-manager-menu-in-hpanel.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/file-manager-menu-in-hpanel.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><ol start=\"4\" class=\"wp-block-list\">\n<li>Access the folder whose PHP version you want to change. To edit a subdomain, go to <strong>public_html &rarr; yoursubdomain <\/strong>folder.<\/li>\n<\/ol><figure class=\"wp-block-image aligncenter size-large\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2016\/06\/opening-a-subdomain-folder-in-hpanel-file-manager.png\"><img decoding=\"async\" width=\"1024\" height=\"505\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/opening-a-subdomain-folder-in-hpanel-file-manager.png\/public\" alt=\"The subdomain folder in File Manager on hPanel\n\" class=\"wp-image-73155\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/opening-a-subdomain-folder-in-hpanel-file-manager.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/opening-a-subdomain-folder-in-hpanel-file-manager.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/opening-a-subdomain-folder-in-hpanel-file-manager.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/opening-a-subdomain-folder-in-hpanel-file-manager.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><ol start=\"5\" class=\"wp-block-list\">\n<li>Double-click on the <strong>.htaccess <\/strong>file. If it doesn&rsquo;t exist, <a href=\"\/tutorials\/locate-and-create-htaccess\">create a new .htaccess file<\/a>.<\/li>\n<\/ol><figure class=\"wp-block-image aligncenter size-large\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2016\/06\/editing-.htaccess-in-hpanel.png\"><img decoding=\"async\" width=\"1024\" height=\"426\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/editing-.htaccess-in-hpanel.png\/public\" alt=\"The .htaccess file in the subdomain folder in hPanel's file manager\n\" class=\"wp-image-73154\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/editing-.htaccess-in-hpanel.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/editing-.htaccess-in-hpanel.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/editing-.htaccess-in-hpanel.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/editing-.htaccess-in-hpanel.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><ol start=\"6\" class=\"wp-block-list\">\n<li>Copy and paste the following command to the beginning of the <strong>.htaccess <\/strong>file to install<strong> PHP 8.1<\/strong>. To install a different PHP version, change <strong>81 <\/strong>with your desired version number. Read our <a href=\"https:\/\/support.hostinger.com\/en\/articles\/4047803-how-to-change-php-version-for-subfolders-or-subdomains\" target=\"_blank\" rel=\"noopener\">PHP version change<\/a> article to view other useful commands.<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;FilesMatch \"\\.(php4|php5|php3|php2|php|phtml)$\"&gt;\nSetHandler application\/x-lsphp81\n&lt;\/FilesMatch&gt;<\/pre><ol start=\"7\" class=\"wp-block-list\">\n<li>Click the <strong>disk icon<\/strong> on the top right corner to save the changes.<\/li>\n<\/ol><figure class=\"wp-block-image aligncenter size-large\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2016\/06\/saving-changes-to-the-.htaccess-file.png\"><img decoding=\"async\" width=\"1460\" height=\"274\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/saving-changes-to-the-.htaccess-file.png\/public\" alt=\"The disk icon for saving the .htaccess file changes\n\" class=\"wp-image-73156\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/saving-changes-to-the-.htaccess-file.png\/w=1460,fit=scale-down 1460w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/saving-changes-to-the-.htaccess-file.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/saving-changes-to-the-.htaccess-file.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/saving-changes-to-the-.htaccess-file.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2016\/06\/saving-changes-to-the-.htaccess-file.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1460px) 100vw, 1460px\" \/><\/a><\/figure><p>Optionally, <a href=\"https:\/\/support.hostinger.com\/en\/articles\/5920192-how-to-check-my-php-version\" target=\"_blank\" rel=\"noopener\">create a phpinfo.php<\/a><strong> <\/strong>file to check your PHP settings and version.<\/p><p>To use multiple PHP versions, repeat the steps above for each subdomain or folder.<\/p><p>However, we don&rsquo;t recommend modifying the <strong>.htaccess<\/strong> file to change your PHP version. This method doesn&rsquo;t include PHP extensions and options, which may affect your site&rsquo;s functionality.<\/p><p>If you choose this method, consider manually configuring the PHP modules and options by <a href=\"https:\/\/docs.bitnami.com\/aws\/apps\/dokuwiki\/configuration\/install-modules-php\/\" target=\"_blank\" rel=\"noopener\">editing the php.ini<strong> <\/strong>file<\/a>.<\/p><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>PHP is a server-side scripting language used for web development. Popular CMSs like WordPress and Joomla are based on PHP.<\/p><p>You may want to switch to a different PHP version for various reasons, such as improving your website&rsquo;s performance and fixing compatibility issues.<\/p><p>However, changing the PHP version can affect your website&rsquo;s functionality. Consider the following before switching your PHP version:<\/p><ul class=\"wp-block-list\">\n<li>Update your CMS to the newest version<\/li>\n\n\n\n<li>Renew your site code<\/li>\n\n\n\n<li>Resolve existing PHP errors or warnings<\/li>\n<\/ul><p>You can use <strong>hPanel <\/strong>or other hosting control panels<strong> <\/strong>to change your hosting account&rsquo;s PHP version. Alternatively, change the PHP version for a specific folder or subdomain by adding a command to your <strong>.htaccess <\/strong>file.<\/p><h2 class=\"wp-block-heading\" id=\"h-change-php-version-faq\">Change PHP Version FAQ<\/h2><p>This section will answer some of the most commonly asked questions about changing your PHP version. If your question remains unanswered, leave it in the comments section below.<\/p><div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1671542707344\"><h3 class=\"schema-faq-question\">How to Check My PHP Version?<\/h3> <p class=\"schema-faq-answer\">Use your hosting control panel to check the PHP version installed on your site. Since the steps vary across different control panels, always refer to the user manual.<br><br>For <strong>hPanel <\/strong>users,click the <strong>Manage <\/strong>button next to a domain &rarr; <strong>Advanced<\/strong> &rarr;&nbsp; <strong>PHP info<\/strong>. If you have a <strong>cPanel <\/strong>account<strong>, <\/strong>go to Software &rarr; <strong>Select PHP version<\/strong>.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1671542732022\"><h3 class=\"schema-faq-question\">Which PHP Version Should I Use?<\/h3> <p class=\"schema-faq-answer\">We recommend using the latest PHP stable release that compatible with WordPress to ensure your site runs properly. At the time of writing, it is<strong> PHP 8.3<\/strong>.<br><br>Since PHP updates frequently, always check the <a href=\"https:\/\/www.php.net\/downloads.php\" target=\"_blank\" rel=\"noopener\">PHP download page<\/a> before switching.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1671542762673\"><h3 class=\"schema-faq-question\">Can I Downgrade My PHP Version?<\/h3> <p class=\"schema-faq-answer\">Yes, you can downgrade your site&rsquo;s PHP to any version. But note that downgrading PHP to an older version may cause errors.<br><br>The best way to downgrade your PHP version is via your hosting control panel. If you use <strong>hPanel<\/strong>, follow our article on <a href=\"https:\/\/support.hostinger.com\/en\/articles\/1575755-how-can-i-change-my-php-version\" target=\"_blank\" rel=\"noopener\">downgrading your PHP version.<\/a><\/p> <\/div> <\/div>\n","protected":false},"excerpt":{"rendered":"<p>Hypertext Preprocessor (PHP) is an open-source server-side scripting language widely used for web development. It is also used in popular [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/tutorials\/how-to-change-your-php-version\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":24,"featured_media":79767,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to Change PHP Version of a Website Without Breaking It","rank_math_description":"Check out this article to learn how to change the PHP version for your website using hPanel, as well as why you should do so.","rank_math_focus_keyword":"change php version, change php version, updating php version, changing php version","footnotes":""},"categories":[22628,22630],"tags":[],"class_list":["post-536","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hosting","category-technical-aspects"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/how-to-change-your-php-version","default":0},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/atualizar-php-hostinger","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/tutoriels\/changer-version-php","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/tutorial\/cara-mengganti-versi-php","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/how-to-change-your-php-version","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/how-to-change-your-php-version","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/how-to-change-your-php-version","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/atualizar-php-hostinger","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/how-to-change-your-php-version","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/how-to-change-your-php-version","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/how-to-change-your-php-version","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/how-to-change-your-php-version","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/536","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/users\/24"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/comments?post=536"}],"version-history":[{"count":35,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/536\/revisions"}],"predecessor-version":[{"id":138460,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/536\/revisions\/138460"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/media\/79767"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/media?parent=536"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/categories?post=536"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/tags?post=536"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}