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

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.

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

In most cases, upgrading PHP 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 versions 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 and then log in to the cPanel dashboard.

login cpanel

Step – 2. Find ‘Select PHP Version’

After successfully logging 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
Get Hostinger Hosting

Is Your Website Slow?

Migrate to Hostinger and get up to 80% off on all shared hosting plans. Hostinger is one best hosting in terms of performance and affordability. Starts at $1.99/mo.

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 the 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 apt update
sudo apt install lsb-release ca-certificates apt-transport-https software-properties-common -y
sudo add-apt-repository ppa:ondrej/php

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 

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.

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

Necessary PHP Modules for WordPress:

sudo apt install php8.0-common php8.0-cli php8.0-bz2 php8.0-curl php8.0-gd php8.0-intl php8.0-readline php8.0-xml php8.0-zip php8.0-fpm php8.0-bcmath php8.0-mbstring php8.0-imagick php8.0-mysql php8.0-zip

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 and 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

Must Read:- 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 plugin 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 most 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 the 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 me in the comment.


Sign up for the newsletter and get our latest tutorials straight to your inbox.

We’ll never share your email address or spam you.

2 thoughts on “How to Upgrade PHP 7.4 to PHP 8.0 – Easiest Method For WordPress”

  1. I am searching on google how to update php version on wordpress and I find your post. And after reading your content, hopefully, now we can update. Thank you!

    Reply

Leave a Comment