Well, it’s not perfectly a LAMP stack as MySQL and PHPMYadmin are not covered here. But for someone who needs a backward compatible php edition to work on a modern/latest os built.
Step1: Add PHP repository
We’ll use a bash script to add the repository-
#!/bin/sh # To add this repository please do: if [ "$(whoami)" != "root" ]; then SUDO=sudo fi ${SUDO} apt-get update ${SUDO} apt-get -y install lsb-release ca-certificates curl ${SUDO} curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb ${SUDO} dpkg -i /tmp/debsuryorg-archive-keyring.deb ${SUDO} sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' ${SUDO} apt-get update
Step-2: Install PHP Modules
Install a few dependencies required by this tutorial with the below-mentioned command:
sudo apt install software-properties-common ca-certificates lsb-release apt-transport-https
Install PHP 7.4:
sudo apt install php7.4
if you want to add multiple extensions then include them in braces, I am going to install “php-mbstring, php-mysql, php-xml, and php-curl” by running the below-mentioned command:
sudo apt install php7.4-mysql php7.4-mbstring php7.4-xml php7.4-curl
Src:
https://packages.sury.org/php/README.txt