Question

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

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.

Hi @angus,

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

  1. wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debian_repo.sh | sudo bash

More, https://docs.litespeedtech.com/extapp/php/getting_started/

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.

More, https://docs.litespeedtech.com/cloud/images/wordpress/#how-do-i-use-lsphp80

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

Hello,

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:

https://www.digitalocean.com/community/questions/how-to-upgrade-php-version-from-7-2-to-php-7-3-in-ubuntu-16-04

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:

https://marketplace.digitalocean.com/apps/openlitespeed-wordpress

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

https://wordpress.org/plugins/duplicator/

Best,

Bobby