Saturday, January 4, 2025
Google search engine
HomeGuest BlogsHow To Install PHP 7.3 on Debian 9 / Debian 8

How To Install PHP 7.3 on Debian 9 / Debian 8

.tdi_3.td-a-rec{text-align:center}.tdi_3 .td-element-style{z-index:-1}.tdi_3.td-a-rec-img{text-align:left}.tdi_3.td-a-rec-img img{margin:0 auto 0 0}@media(max-width:767px){.tdi_3.td-a-rec-img{text-align:center}}

This short tutorial is for installing PHP 7.3 on Debian 9 (Stretch) and Debian 8 (Jessie). With PHP 7.3 comes a number of bug fixes, new functionalities and features as well as a number of deprecations.

For Ubuntu 18.04 / Ubuntu 16.04, use:

How to install PHP 7.3 on Ubuntu

.tdi_2.td-a-rec{text-align:center}.tdi_2 .td-element-style{z-index:-1}.tdi_2.td-a-rec-img{text-align:left}.tdi_2.td-a-rec-img img{margin:0 auto 0 0}@media(max-width:767px){.tdi_2.td-a-rec-img{text-align:center}}

If you’re running a CentOS 7 system, then follow the guide on the link below:

How to Install PHP 7.3 on CentOS 7

Fedora 29 / Fedora 28: How to Install PHP 7.3 on Fedora

Install PHP 7.3 on Debian 9 / Debian 8

Follow the steps provided below to install 7.3 on Debian 9 / Debian 8

Step 1: Update system and Install add-apt-repository

Ensure your system is updated:

sudo apt update
sudo apt upgrade -y

If you don’t have add-apt-repository command available in your system, install it using our guide below:

How to Install add-apt-repository on Debian / Ubuntu

Step 2: Add  PHP 7.3 PPA repository

Once the add-apt-repository command is available, add PHP 7.3 PPA repository

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/php.list

Step 3: Install PHP 7.3 on Debian 9 / Debian 8

The last step is to Install PHP 7.3 on Debian 9 / Debian 8. First, run the apt update command:

$ sudo apt update
Hit:2 https://packages.sury.org/php stretch InRelease
Ign:1 http://cdn-fastly.deb.debian.org/debian stretch InRelease
Hit:3 http://cdn-fastly.deb.debian.org/debian stretch Release
Reading package lists… Done
Building dependency tree
Reading state information… Done
4 packages can be upgraded. Run 'apt list --upgradable' to see them.

Then install  PHP 7.3 on Debian 9 / Debian 8:

sudo apt -y install php7.3

Check version installed

$ php -v
PHP 7.3.29-1+0~20210701.86+debian9~1.gbp7ad6eb (cli) (built: Jul  1 2021 16:11:36) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.29, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.29-1+0~20210701.86+debian9~1.gbp7ad6eb, Copyright (c) 1999-2018, by Zend Technologies

Step 4: Installing PHP 7.3 Extensions

Install PHP 7.3 extensions by using the syntax

 sudo apt install php7.3-<entension-name>

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
php7.3-cli:
  Installed: 7.3.29-1+0~20210701.86+debian9~1.gbp7ad6eb
  Candidate: 7.3.29-1+0~20210701.86+debian9~1.gbp7ad6eb
  Version table:
 *** 7.3.29-1+0~20210701.86+debian9~1.gbp7ad6eb 500
        500 https://packages.sury.org/php stretch/main amd64 Packages
        100 /var/lib/dpkg/status

Congratulations!!. You have successfully installed PHP 7.3 on Debian 9 / Debian 8.

PHP Web Programming Video Courses:

.tdi_4.td-a-rec{text-align:center}.tdi_4 .td-element-style{z-index:-1}.tdi_4.td-a-rec-img{text-align:left}.tdi_4.td-a-rec-img img{margin:0 auto 0 0}@media(max-width:767px){.tdi_4.td-a-rec-img{text-align:center}}

RELATED ARTICLES

Most Popular

Recent Comments