{"id":2012,"date":"2023-12-01T13:48:04","date_gmt":"2023-12-01T13:48:04","guid":{"rendered":"https:\/\/hostingspell.com\/blog\/?p=2012"},"modified":"2023-12-01T13:48:06","modified_gmt":"2023-12-01T13:48:06","slug":"comprehensive-guide-changing-php-versions-for-websites-with-cloudlinux","status":"publish","type":"post","link":"https:\/\/blog.hostingspell.com\/comprehensive-guide-changing-php-versions-for-websites-with-cloudlinux\/","title":{"rendered":"Comprehensive Guide: Changing PHP Versions for Websites with CloudLinux"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Ensuring your website operates on the right PHP version is essential for optimal performance. In this guide, we&#8217;ll walk through two methods of changing PHP versions using CloudLinux&#8217;s Select PHP Version feature and via .htaccess. These methods are applicable to various web applications, not just limited to WordPress.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Method 1: Using CloudLinux&#8217;s Select PHP Version<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Log in to cPanel<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Log in to your cPanel account.<\/li>\n\n\n\n<li>Navigate to the &#8216;Software&#8217; section.<\/li>\n\n\n\n<li>Click on &#8216;Select PHP Version.&#8217;<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Choose PHP Version<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Select the domain(s) for which you want to change the PHP version.<\/li>\n\n\n\n<li>Choose the desired PHP version from the dropdown menu.<\/li>\n\n\n\n<li>Click &#8216;Apply.&#8217;<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Verify Changes<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Visit your website.<\/li>\n\n\n\n<li>Check for any compatibility issues.<\/li>\n\n\n\n<li>Ensure the PHP version has been updated.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Method 2: Setting Custom PHP Version via .htaccess for multiple sites<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Locate the .htaccess File<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Access your hosting control panel and navigate to the &#8216;File Manager.&#8217;<\/li>\n\n\n\n<li>Make sure you have enabled the Show Hidden Files\/Folders option in File Manager from the menu in the top right. Here is the <a href=\"https:\/\/hostadvice.com\/how-to\/web-hosting\/cpanel\/how-to-see-the-hidden-files-using-cpanels-file-manager\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">guide<\/a> for it!<\/li>\n\n\n\n<li>Find the root directory of the addon domain or subdomain where you want to set a custom PHP version.<\/li>\n\n\n\n<li>In the &#8216;File Manager,&#8217; locate the .htaccess file and right-click to edit it. If it doesn&#8217;t exist, create a new one.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Edit .htaccess File<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Alternatively, use the text editor within the &#8216;File Manager&#8217; to create and edit the .htaccess file.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Add Custom PHP Version<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To set a PHP version, add the following line:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>AddHandler application\/x-httpd-alt-php74___lsphp .PHP<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace <strong>74<\/strong> with your desired PHP version, ensuring compatibility with your web application. For example, for PHP 8.1 use <strong>81<\/strong> or <strong>80<\/strong> for PHP 8.1.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Save and Verify<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Save the changes to the .htaccess file.<\/li>\n\n\n\n<li>Visit your website and check for any compatibility issues.<\/li>\n\n\n\n<li>If you see the site is broken then verify that the PHP version has been updated as intended.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">In some cases, you will have to connect with Web Developers to ensure which PHP version is required.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ensuring your website operates on the right PHP version is essential for optimal performance. In this guide, we&#8217;ll walk through two methods of changing PHP versions using CloudLinux&#8217;s Select PHP Version feature and via .htaccess. These methods are applicable to various web applications, not just limited to WordPress. Method 1: Using CloudLinux&#8217;s Select PHP Version [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":1647,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-2012","post","type-post","status-publish","format-standard","has-post-thumbnail","category-general","entry"],"featured_image_src":"https:\/\/blog.hostingspell.com\/wp-content\/uploads\/2021\/03\/hspl-blog-default.png","featured_image_src_square":"https:\/\/blog.hostingspell.com\/wp-content\/uploads\/2021\/03\/hspl-blog-default.png","author_info":{"display_name":"C01R3","author_link":"https:\/\/blog.hostingspell.com\/author\/c01r3\/"},"uagb_featured_image_src":{"full":["https:\/\/blog.hostingspell.com\/wp-content\/uploads\/2021\/03\/hspl-blog-default.png",580,290,false],"thumbnail":["https:\/\/blog.hostingspell.com\/wp-content\/uploads\/2021\/03\/hspl-blog-default-150x150.png",150,150,true],"medium":["https:\/\/blog.hostingspell.com\/wp-content\/uploads\/2021\/03\/hspl-blog-default-300x150.png",300,150,true],"medium_large":["https:\/\/blog.hostingspell.com\/wp-content\/uploads\/2021\/03\/hspl-blog-default.png",580,290,false],"large":["https:\/\/blog.hostingspell.com\/wp-content\/uploads\/2021\/03\/hspl-blog-default.png",580,290,false],"1536x1536":["https:\/\/blog.hostingspell.com\/wp-content\/uploads\/2021\/03\/hspl-blog-default.png",580,290,false],"2048x2048":["https:\/\/blog.hostingspell.com\/wp-content\/uploads\/2021\/03\/hspl-blog-default.png",580,290,false],"single-featured-image":["https:\/\/blog.hostingspell.com\/wp-content\/uploads\/2021\/03\/hspl-blog-default.png",580,290,false],"blog-featured-image":["https:\/\/blog.hostingspell.com\/wp-content\/uploads\/2021\/03\/hspl-blog-default.png",580,290,false],"home-featured":["https:\/\/blog.hostingspell.com\/wp-content\/uploads\/2021\/03\/hspl-blog-default-380x290.png",380,290,true],"ab-block-post-grid-landscape":["https:\/\/blog.hostingspell.com\/wp-content\/uploads\/2021\/03\/hspl-blog-default.png",580,290,false],"ab-block-post-grid-square":["https:\/\/blog.hostingspell.com\/wp-content\/uploads\/2021\/03\/hspl-blog-default.png",580,290,false],"author-pro-image":["https:\/\/blog.hostingspell.com\/wp-content\/uploads\/2021\/03\/hspl-blog-default.png",360,180,false],"gb-block-post-grid-landscape":["https:\/\/blog.hostingspell.com\/wp-content\/uploads\/2021\/03\/hspl-blog-default.png",580,290,false],"gb-block-post-grid-square":["https:\/\/blog.hostingspell.com\/wp-content\/uploads\/2021\/03\/hspl-blog-default.png",580,290,false]},"uagb_author_info":{"display_name":"C01R3","author_link":"https:\/\/blog.hostingspell.com\/author\/c01r3\/"},"uagb_comment_info":0,"uagb_excerpt":"Ensuring your website operates on the right PHP version is essential for optimal performance. In this guide, we&#8217;ll walk through two methods of changing PHP versions using CloudLinux&#8217;s Select PHP Version feature and via .htaccess. These methods are applicable to various web applications, not just limited to WordPress. Method 1: Using CloudLinux&#8217;s Select PHP Version&hellip;","_links":{"self":[{"href":"https:\/\/blog.hostingspell.com\/wp-json\/wp\/v2\/posts\/2012","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.hostingspell.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.hostingspell.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.hostingspell.com\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.hostingspell.com\/wp-json\/wp\/v2\/comments?post=2012"}],"version-history":[{"count":1,"href":"https:\/\/blog.hostingspell.com\/wp-json\/wp\/v2\/posts\/2012\/revisions"}],"predecessor-version":[{"id":2013,"href":"https:\/\/blog.hostingspell.com\/wp-json\/wp\/v2\/posts\/2012\/revisions\/2013"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.hostingspell.com\/wp-json\/wp\/v2\/media\/1647"}],"wp:attachment":[{"href":"https:\/\/blog.hostingspell.com\/wp-json\/wp\/v2\/media?parent=2012"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.hostingspell.com\/wp-json\/wp\/v2\/categories?post=2012"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.hostingspell.com\/wp-json\/wp\/v2\/tags?post=2012"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}