How do I upgrade my PHP version?

I cannot find anywhere how to do this. Wordpress is telling me an upgrade is required but they tell me to go my hosting company to upgrade PHP. Linode tells me PHP is not part of the services they provide. Any help is much appreciated.

5 Replies

I think I located your account and I took note of your distribution version, so I’ll form my advice around this information. I’m not sure which version of PHP you’re currently running, but the below instructions detail how to upgrade to PHP 7.4 or 8.0.

Before getting started, there’s some risk to consider when upgrading to a PHP version that isn’t native to your distribution version - you can read more details surrounding this in this Community post.

Retrofitting this newer version with your distribution requires you to download a PHP repository, which is covered in these steps.

1) Update server:

sudo apt-get update && apt-get upgrade

2) Prep for PHP repository:

sudo apt -y install software-properties-common

3) Add PHP repository

sudo add-apt-repository ppa:ondrej/php

4) Update repository index

sudo apt-get update

5) Install php7.4

sudo apt-get install php7.4

6) Install php extensions (run dpkg -l php7.4* for list) - these are some common ones:

sudo apt install php7.4-common php7.4-mysql php7.4-xml php7.4-xmlrpc php7.4-curl php7.4-gd php7.4-imagick php7.4-cli php7.4-dev php7.4-imap php7.4-mbstring php7.4-opcache php7.4-soap php7.4-zip php7.4-intl -y

Since you’ll now have multiple PHP versions on your server, you’ll want to set this as the default:

update-alternatives --set php /usr/bin/php7.4

If you wanted to install PHP 8.0 instead of 7.4, you could do the following:

sudo apt-get update && apt-get upgrade
sudo apt -y install software-properties-common
sudo add-apt-repository ppa:ondrej/php
apt-get install php7.4
apt-get install libapache2-mod-php7.4 php7.4-fpm libapache2-mod-fcgid php7.4-curl php7.4-dev php7.4-gd php7.4-mbstring php7.4-zip php7.4-mysql php7.4-xml
update-alternatives --set php /usr/bin/php8.0

Thank you so much for the help here. If I add on the C-panel will upgrading my PHP be easier through a dashboard of sorts? Or would I still need to run code manually?

Thanks @jtoscani

@foxkeeper Since it sounds like you already have an existing server, it is mostly easier to follow the instructions @jtoscani laid out. This is because installing cPanel on an existing server will erase the current contents. It is possible to deploy a new server using our cPanel Marketplace App. Then you'd need to transfer your website files over to it. You may find the below links helpful with migrating your data to a new server.

Hi, I have the same issue. The instructions worked great. Thanks. However, my Wordpress site is still giving me a hard time:

PHP is the programming language used to build and maintain WordPress. Newer versions of PHP are created with increased performance in mind, so you may see a positive effect on your site’s performance. The minimum recommended version of PHP is 7.4.

Any idea what the problem might be?




Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct