php:version:install
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt update
$ sudo apt install php${version}
This is a sequence of commands that installs a newer version of PHP onto a Linux system that uses apt for package management (such as Ubuntu or Debian).
-
sudo apt install software-properties-common: This command installs a package that provides theadd-apt-repositorycommand, which is needed to add a new package repository (in this case,ppa:ondrej/php) to the system. -
sudo add-apt-repository ppa:ondrej/php: This command adds theondrej/phprepository to the system. This repository provides newer versions of PHP than the default repositories of some Linux distributions. -
sudo apt update: This command updates the local package lists with information about packages available in the newly-added repository. -
sudo apt install php${version}: This command installs the specified version of PHP (where${version}is replaced with the desired version number, such asphp7.4). This will install the necessary packages for that version of PHP, including any required extensions and dependencies.