{"id":163,"date":"2024-05-31T12:02:12","date_gmt":"2024-05-31T12:02:12","guid":{"rendered":"https:\/\/wordpresswebhosting.in\/tutorials\/?p=163"},"modified":"2024-05-31T12:04:12","modified_gmt":"2024-05-31T12:04:12","slug":"how-to-change-the-php-version","status":"publish","type":"post","link":"https:\/\/wordpresswebhosting.in\/tutorials\/how-to-change-the-php-version\/","title":{"rendered":"How to change the PHP version"},"content":{"rendered":"<h2>How to change the PHP version<\/h2>\n<figure style=\"width: 960px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.elegantthemes.com\/blog\/wp-content\/uploads\/2019\/06\/featured-php-7.png\" alt=\"How to change the PHP version\" width=\"960\" height=\"440\" \/><figcaption class=\"wp-caption-text\">How to change the PHP version<\/figcaption><\/figure>\n<h2>Changing the PHP version on your server can be necessary for compatibility with different applications or to take advantage of new features and performance improvements.<\/h2>\n<p>The steps to change the PHP version depend on the web server and control panel you are using.<\/p>\n<p>How to change the PHP version &#8211; Here, we&#8217;ll cover the process for some common environments: cPanel, Plesk, and command-line on a Linux server.<\/p>\n<figure style=\"width: 1200px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/rocket.net\/wp-content\/uploads\/2022\/11\/PHP-81-min.png\" alt=\"How to change the PHP version\" width=\"1200\" height=\"630\" \/><figcaption class=\"wp-caption-text\">How to change the PHP version<\/figcaption><\/figure>\n<h3>Changing PHP Version in cPanel<\/h3>\n<ol>\n<li><strong>Log into cPanel<\/strong>:\n<ul>\n<li>Access your cPanel account through your <a href=\"https:\/\/www.wordpresswebhosting.in\/linux_hosting\/\">hosting provider\u2019s login page<\/a>.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Find the PHP Selector<\/strong>:\n<ul>\n<li>In the <strong>Software<\/strong> section, click on <strong>Select PHP Version<\/strong> or <strong>MultiPHP Manager<\/strong>, depending on your hosting provider\u2019s configuration.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Select PHP Version<\/strong>:\n<ul>\n<li>If using <strong>Select PHP Version<\/strong>:\n<ul>\n<li>Choose the domain for which you want to change the PHP version.<\/li>\n<li>Select the desired PHP version from the dropdown menu.<\/li>\n<li>Click <strong>Set as current<\/strong> to apply the changes.<\/li>\n<\/ul>\n<\/li>\n<li>If using <strong>MultiPHP Manager<\/strong>:\n<ul>\n<li>Check the box next to the domain(s) you want to change.<\/li>\n<li>Select the desired PHP version from the dropdown at the top of the page.<\/li>\n<li>Click <strong>Apply<\/strong> to save the changes.\n<p><figure style=\"width: 1200px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.hostbet.in\/blog\/wp-content\/uploads\/2023\/06\/20230618_161022_0000.png\" alt=\"How to change the PHP version\" width=\"1200\" height=\"628\" \/><figcaption class=\"wp-caption-text\">How to change the PHP version<\/figcaption><\/figure><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h3>Changing PHP Version in Plesk<\/h3>\n<ol>\n<li><strong>Log into Plesk<\/strong>:\n<ul>\n<li>Access your Plesk control panel through your hosting provider\u2019s login page.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Go to Hosting Settings<\/strong>:\n<ul>\n<li>In the <strong>Websites &amp; Domains<\/strong> section, find the domain you want to change the PHP version for.<\/li>\n<li>Click on <strong>Hosting Settings<\/strong>.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Select PHP Version<\/strong>:\n<ul>\n<li>Find the <strong>PHP support<\/strong> section.<\/li>\n<li>Use the <strong>PHP version<\/strong> dropdown to select the desired version.<\/li>\n<li>Click <strong>OK<\/strong> or <strong>Apply<\/strong> to save the changes.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h3>Changing PHP Version via Command-Line on a <a href=\"https:\/\/www.squarebrothers.com\/web-hosting-india\/\" target=\"_blank\" rel=\"noopener\">Linux Server<\/a><\/h3>\n<ol>\n<li><strong>Check Current PHP Version<\/strong>:\n<ul>\n<li>Open a terminal or SSH into your server.<\/li>\n<li>Run the command:\n<div class=\"dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium\">\n<div class=\"flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md\">\n<p>bash<\/p>\n<div class=\"flex items-center\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center\">Copy code<\/button><\/span><\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4 text-left undefined\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">php -v<br \/>\n<\/code><\/div>\n<\/div>\n<\/li>\n<li>This will display the currently active PHP version.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Install New PHP Version<\/strong> (if not already installed):\n<ul>\n<li>For <strong>Ubuntu<\/strong>:\n<div class=\"dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium\">\n<div class=\"flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md\">\n<p>bash<\/p>\n<div class=\"flex items-center\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center\">Copy code<\/button><\/span><\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4 text-left undefined\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">sudo apt update<br \/>\nsudo apt install php7.x<br \/>\n<\/code><\/div>\n<\/div>\n<\/li>\n<li>For <strong>CentOS<\/strong>:\n<div class=\"dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium\">\n<div class=\"flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md\">\n<p>bash<\/p>\n<div class=\"flex items-center\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center\">Copy code<\/button><\/span><\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4 text-left undefined\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">sudo yum install epel-release<br \/>\nsudo yum install php7.x<br \/>\n<\/code><\/div>\n<\/div>\n<\/li>\n<li>Replace <code>7.x<\/code> with the desired PHP version number (e.g., <code>7.4<\/code>, <code>8.0<\/code>).<\/li>\n<\/ul>\n<\/li>\n<li><strong>Update Alternatives<\/strong>:\n<ul>\n<li>On <strong>Ubuntu<\/strong>:\n<div class=\"dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium\">\n<div class=\"flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md\">\n<p>bash<\/p>\n<div class=\"flex items-center\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center\">Copy code<\/button><\/span><\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4 text-left undefined\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">sudo update-alternatives --<span class=\"hljs-built_in\">set<\/span> php \/usr\/bin\/php7.x<br \/>\n<\/code><\/div>\n<\/div>\n<\/li>\n<li>On <strong>CentOS<\/strong>, you may need to update the symlinks manually:\n<div class=\"dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium\">\n<div class=\"flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md\">\n<p>bash<\/p>\n<div class=\"flex items-center\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center\">Copy code<\/button><\/span><\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4 text-left undefined\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">sudo <span class=\"hljs-built_in\">ln<\/span> -sf \/usr\/bin\/php7.x \/usr\/bin\/php<br \/>\n<\/code><\/div>\n<\/div>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong>Restart Web Server<\/strong>:\n<ul>\n<li>For <strong>Apache<\/strong>:\n<div class=\"dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium\">\n<div class=\"flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md\">\n<p>bash<\/p>\n<div class=\"flex items-center\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center\">Copy code<\/button><\/span><\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4 text-left undefined\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">sudo systemctl restart apache2   <span class=\"hljs-comment\"># On Ubuntu\/Debian<\/span><br \/>\nsudo systemctl restart httpd     <span class=\"hljs-comment\"># On CentOS\/RHEL<\/span><br \/>\n<\/code><\/div>\n<\/div>\n<\/li>\n<li>For <strong>Nginx<\/strong> (you might need to configure PHP-FPM):\n<div class=\"dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium\">\n<div class=\"flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md\">\n<p>bash<\/p>\n<div class=\"flex items-center\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center\">Copy code<\/button><\/span><\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4 text-left undefined\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">sudo systemctl restart php7.x-fpm<br \/>\nsudo systemctl restart nginx<br \/>\n<\/code><\/div>\n<\/div>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong>Verify PHP Version<\/strong>:\n<ul>\n<li>Run the command again to confirm the change:\n<div class=\"dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium\">\n<div class=\"flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md\">\n<p>bash<\/p>\n<div class=\"flex items-center\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center\">Copy code<\/button><\/span><\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4 text-left undefined\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">php -v<br \/>\n<\/code><\/div>\n<\/div>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h3>Post-Change Verification<\/h3>\n<p>After changing the PHP version, it&#8217;s important to verify that your applications are working correctly. Check the following:<\/p>\n<ul>\n<li><strong>Website Functionality<\/strong>: Visit your website and ensure all features are functioning as expected.<\/li>\n<li><strong>Error Logs<\/strong>: Check the server error logs for any PHP-related errors.<\/li>\n<li><strong>Compatibility<\/strong>: Make sure your applications and plugins are compatible with the new PHP version.<\/li>\n<\/ul>\n<p>By following these steps, you can change the PHP version on your server using different control panels or the command-line interface, ensuring your web environment meets the required specifications for your applications.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to change the PHP version Changing the PHP version on your server can be necessary for compatibility with different applications or to take advantage of new features and performance improvements. The steps to change the PHP version depend on the web server and control panel you are using. How to change the PHP version<a class=\"sup-readmore\" href=\"https:\/\/wordpresswebhosting.in\/tutorials\/how-to-change-the-php-version\/\">Read More<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-163","post","type-post","status-publish","format-standard","hentry","category-hosting"],"_links":{"self":[{"href":"https:\/\/wordpresswebhosting.in\/tutorials\/wp-json\/wp\/v2\/posts\/163","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpresswebhosting.in\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpresswebhosting.in\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpresswebhosting.in\/tutorials\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpresswebhosting.in\/tutorials\/wp-json\/wp\/v2\/comments?post=163"}],"version-history":[{"count":3,"href":"https:\/\/wordpresswebhosting.in\/tutorials\/wp-json\/wp\/v2\/posts\/163\/revisions"}],"predecessor-version":[{"id":166,"href":"https:\/\/wordpresswebhosting.in\/tutorials\/wp-json\/wp\/v2\/posts\/163\/revisions\/166"}],"wp:attachment":[{"href":"https:\/\/wordpresswebhosting.in\/tutorials\/wp-json\/wp\/v2\/media?parent=163"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpresswebhosting.in\/tutorials\/wp-json\/wp\/v2\/categories?post=163"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpresswebhosting.in\/tutorials\/wp-json\/wp\/v2\/tags?post=163"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}