How to Upgrade PHP 7.4 to PHP 8.0 – Easiest Method For WordPress

Loading...

PHP is a core part of all WordPress websites, and if your WordPress website is saying to upgrade to the latest version of PHP, you should upgrade.

PHP 8.0 upgradation’s primary purpose is website security, and you know the latest version always comes with security patches of old vulnerabilities.

In most cases, PHP upgradation is very easy, or at some point not even not possible. But in this article, I will explain all proven and safest methods to upgrade to the latest PHP version.

So, let’s get started.

Switch PHP Version on cPanel for Shared Hosting User

In shared hosting platform or some managed WordPress hosting providers give you to switch PHP version by changing the setting, without any frustrations. You can upgrade PHP from your current version, and even you can downgrade.

STEP – 1. Login cPanel of Your Hosting

cPanel is your web hosting control panel where you can manage your website’s core things, so first of all, you need to log in to your host provider’s website then login to the cPanel dashboard.

login cpanel

STEP – 2. Find ‘Select PHP Version’

After successfully logged in to the cPanel dashboard, you need to find ‘Select PHP Version,’ which is present on the software section of cPanel. So scroll down and click on ‘Select PHP Version.’

select php selector

STEP – 3. Switch PHP Version 7.4 to PHP 8.0

Now click on the current PHP version, then you will see the list of different PHP versions. Select the latest version, PHP 8.0, and click on ‘Set default.’

PHP selector for PHP 8.0

Affordable & Fastest Shared Web hosting


Check out Hostinger shared web hosting at the lowest price in the market, get remarkable performance with next-gen LiteSpeed server technology. The plans start from $0.99 per month at a 90% discount.

Install PHP 8.0 Manually On Debian and Ubuntu Based Server

If you are using a dedicated VPS or cloud server, you need to manage your server by yourself, so if you have hosted your WordPress website or any other web application, which is required the latest version of PHP.

You can install the latest PHP version or switch current PHP to PHP 8.0 on your Linux server.

STEP – 1. Update Your System

To update system use the following command.

sudo apt update

STEP – 2. Add Latest Repository for PHP 8.0

After updating the system, need to execute the latest PHP repository command for adding to the system.

Ubuntu:-

sudo add-apt-repository ppa:ondrej/php
sudo apt update

Debian:-

sudo apt update
sudo apt install -y gnupg2 ca-certificates apt-transport-https software-properties-common
wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add -
echo "deb https://packages.sury.org/php/ buster main" | sudo tee /etc/apt/sources.list.d/php.list 
sudo apt update

STEP – 3. Install PHP 8.0

After adding the repository to the system, now execute the following command for installing PHP 8.0.

sudo apt install php8.0

Or

sudo apt install php8.0-common php8.0-cli

STEP – 4. Install PHP Modules/Extension

After successfully installing the latest PHP 8.0, you need to execute the following commands for installing the necessary PHP modules.

Loading...
sudo apt install php8.0-{bz2,curl,intl,mysql,readline,xml}

STEP – 5. Check PHP Version

Finally, it would be best if you crossed verifies and executed the following commands to check the installed PHP version and the modules.

sudo php -v
sudo php -m

STEP – 6. Switch Current PHP to Latest PHP 8.0

If you have installed WordPress on your system and need to work with the latest PHP, you need to disable the older version of PHP, enable the latest one, PHP 8.0, so execute the following commands.

Apache:

Disable Old PHP Version:-

sudo a2dismod php7.4

Enable New PHP Version:-

sudo a2enmod php8.0

Restart Apache Server:-

sudo systemctl restart apache2.service

Or

sudo service apache2 restart

Check out How To Install WordPress On LAMP Stack


FAQs about upgrading PHP

Do I need to update PHP on WordPress?

Yes, an obsolete PHP version is harmful to your WordPress website. The latest PHP comes with better security and the latest plugins support. You should use the minimum required PHP version on the WordPress website.

Is PHP 8 backward compatible?

PHP 8.0 is backward compatible and comes with new features, like Named Parameters, JIT, Attributes, and Constructor Properties.

What is the best PHP version for WordPress?

The best PHP version for WordPress is the latest and stable PHP version; the newly released PHP is PHP 8.0, and it is now in beta mode. When it would be available, you should upgrade to that.

How do I download PHP?

Users can download the latest PHP via terminal for Linux operating system as mentioned above. But if you want to download for Windows operating system, visit php.net and download for Windows.

How do I upgrade to PHP 8?

For Linux, VPS users can execute commands for upgrading the latest PHP 8.0, or in case you are a cPanel user, you can upgrade PHP 8.0 via PHP Selector on cPanel.

How do I know if PHP is installed?

For Linux users, open terminal and type $ sudo php -v, you will get a detailed report about the PHP version.

Is PHP 7.4 stable?

Yes, PHP 7.4 is currently the latest stable version. PHP 8.0 has been released, but it is now in the beta stage.

Summary

Keeping the latest PHP on a WordPress website and any web application is very important for security.

Recently released PHP 8.0 and will be available to be upgraded in your system in a few days.
This article has described two easy ways for shared hosting users and those who use cloud and dedicated VPS hosting.

You can upgrade to the latest PHP 8.0 using these methods. If you have any problems in upgrading PHP, you can tell in the comment.

Loading...

Pronay

Hi!
I am a blogger and a digital marketer based in Delhi, India. I have a passion for blogging and influencing people from my work. I am a student pursuing a Bachelor's Degree in Science from Delhi University.

Leave a Comment