sudo apt update sudo apt upgrade -y
- sudo apt -y install lsb-release apt-transport-https ca-certificates
- sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
- echo “deb https://packages.sury.org/php/ $(lsb_release -sc) main” | sudo tee /etc/apt/sources.list.d/php7.3.list
- sudo apt update
- sudo apt -y install php7.3
Check Version installed $ php -v See example below which install standard PHP extensions. sudo apt install php7.3-cli php7.3-fpm php7.3-json php7.3-pdo php7.3-mysql php7.3-zip php7.3-gd php7.3-mbstring php7.3-curl php7.3-xml php7.3-bcmath php7.3-json
To install Apache Module for PHP,
run:sudo apt install libapache2-mod-php7.3
Confirm one:
apt policy php7.3-cli
Discussion (3)
Comment posting has been disabled on this doc.
sudo apt install -y curl wget gnupg2 ca-certificates lsb-release apt-transport-https
wget https://packages.sury.org/php/apt.gpg
sudo apt-key add apt.gpg
sudo apt update
echo “deb https://packages.sury.org/php/ $(lsb_release -sc) main” | sudo tee /etc/apt/sources.list.d/php7.list
sudo apt update
sudo apt install -y php7.4 php7.4-cli php7.4-common
sudo apt install -y php7.3 php7.3-cli php7.3-common
sudo apt install -y php7.4-mysql php7.4-ssh2 php7.4-xml php7.4-curl php7.4-gd php7.4-imagick php7.4-json php7.4-mbstring
sudo apt install -y php8.2-mysql php8.2-ssh2 php8.2-xml php8.2-curl php8.2-gd php8.2-imagick php8.2-mbstring