PHP Linode PHP Move To 7.4

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