Updating PHP to latest patch

Hi! :wave:

I have PHP 8.0.1 installed on my server. The newest release is 8.0.13 and it is now causing some problems when installing newer dependencies. What would be the correct way to update this?

Maybe this can be done through the UI, but ssh’ing into the machine is fine too. I found I can run sudo apt-get install php8.0=8.0.13-1+ubuntu20.04.1+deb.sury.org+2 to install the latest version. Do I need to refresh php-fpm or nginx afterwards?

Any help would be much appreciated :slight_smile:

  • Barry

We’d need to double check that command is fine (at a glance it seems OK). From there you can refresh PHP (from command or from Cleavr UI). Shouldn’t be a need to refresh NGINX.

Just gave it a try. Installing went okay but no matter what I do, I don’t see the new PHP version reflected anywhere.

user@host:~$ sudo apt-get install php8.0=8.0.13-1+ubuntu20.04.1+deb.sury.org+2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  php5.6-common php5.6-redis php7.0-common php7.0-redis php7.1-common php7.1-redis php7.2-common php7.2-redis php7.3-common php7.3-redis
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 252 not upgraded.
Need to get 29.6 kB of archives.
After this operation, 65.5 kB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 php8.0 all 8.0.13-1+ubuntu20.04.1+deb.sury.org+2 [29.6 kB]
Fetched 29.6 kB in 0s (602 kB/s)
Selecting previously unselected package php8.0.
(Reading database ... 114865 files and directories currently installed.)
Preparing to unpack .../php8.0_8.0.13-1+ubuntu20.04.1+deb.sury.org+2_all.deb ...
Unpacking php8.0 (8.0.13-1+ubuntu20.04.1+deb.sury.org+2) ...
Setting up php8.0 (8.0.13-1+ubuntu20.04.1+deb.sury.org+2) ...

Even running php -v or php8.0 -v returns the old 8.0.1 version.

I’m wondering if sudo apt-get install is actually upgrading php. However, trying to install it again does tell me that php 8.0 is already the newest version and showing the full and correct version number. :thinking:

Can you give the following command a try and see if it works?

sudo apt-get install --only-upgrade php8.0*

Thanks Ashok, that worked!

So to summarise the steps that solved the problem:

sudo apt-get update
sudo apt-get install --only-upgrade php8.0*
sudo service php8.0-fpm restart