How Can I upgrade PHP7.0 to PHP 7.4?

  • Posted on March 18, 2022
  • PHP
  • angusAnglerAsked by angus

I am using OpenLiteSpeed 1 click WordPress on Ubuntu 16.04. I want upgrade the PHP version to 7.4,

sudo apt-get install php7.4

but failed.

Also I can’t upgrade ubuntu version. Please help

Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Site Moderator
Site Moderator badge
March 21, 2022

Hi @angus,

For native OpenLiteSpeed/LiteSpeed, we can install PHP from LiteSpeed official repository.

  1. wget -O - | sudo bash


Since the image should have this repository installed, we can simply install packages directory like this

Example for lsphp80

  1. apt-get install lsphp80 lsphp80-common lsphp80-mysql lsphp80-memcached lsphp80-redis lsphp80-opcache lsphp80-curl lsphp80-imagick -y

OpenLiteSpeed comes with PHP detached mode by default, so need to restart PHP with the command killall -9 lsphp to make settings take effect.


In your case, you can replace lsphp80 with lsphp74 and it should work

Bobby Iliev
Site Moderator
Site Moderator badge
March 18, 2022


Do you get a specific error when you try to install the newer version?

I could suggest following the steps from the first answer here:

Make sure to first backup your Droplet, as this is a major upgrade, so if anything goes wrong, you would be able to revert back to the working version of your website/server.

Alternatively, what you could do is to deploy a new server with Ubuntu 20.04 and the latest PHP version via this link here:

Then once the server is up and running you could move your website over using a plugin like this one here: