Php 7.3 How to Upgrade Debian Linux 9

This is not as simple as even the most popular blogs explain.

sudo apt update

sudo apt -y install software-properties-common dirmngr apt-transport-https lsb-release ca-certificates

sudo wget -O /etc/apt/trusted.gpg.d/php.gpg

echo “deb $(lsb_release -sc) main” | sudo tee /etc/apt/sources.list.d/php7.3.list

sudo apt update

sudo apt -y install php7.3 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

sudo apt update
sudo apt upgrade

Now you can remove the old Php version. Here’s how you find what is installed

sudo dpkg -l | grep php | tee packages.txt

Remove 7.0 in this example

sudo apt purge php7.0 php7.0-common

sudo apt autoremove

These are often over looked. Your install will not work correctly unless you complete these steps

sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php7.3-fpm
sudo a2enmod php7.3
sudo a2dismod php7.0

sudo apt-get purge dpkg -l | grep php7.0| awk '{print $2}' |tr "\n" " "

sudo systemctl restart apache2

You may also like...