LINUX, FOSS AND LIBRARY TECHNOLOGY ENTHUSIAST

Friday, January 3, 2020

Install PHP 7.3 on Debian 9

0 comments

The term PHP is an acronym for PHP: Hypertext Preprocessor. PHP is a server-side scripting language designed specifically for web development. PHP can be easily embedded in HTML files and HTML codes can also be written in a PHP file. The thing that differentiates PHP with client-side language like HTML is, PHP codes are executed on the server whereas HTML codes are directly rendered on the browser.

sudo su
sudo apt update && apt upgrade

Enable PPA

Let’s execute the following commands to install the required packages first on your system. Then import packages signing key. After that configure PPA for the PHP packages on your system.

sudo apt install ca-certificates apt-transport-https 
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list

Installing PHP 7.3
You can also install the latest PHP version on your system. Run the following commands to install PHP 7.3 on Debian 9.

sudo apt update
sudo apt install php7.3

Also install the required php modules.

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

Check the installation

php -v

Now, PHP 7.3 has been installed on your Debian system, and if we want to change the default PHP version to PHP 7.3 that is used on your web server, we need to disable the old PHP and enable the newly installed one.

Disable php 7.2

a2dismod php7.2

systemctl restart apache2

Enable php 7.3

a2enmod php7.3

systemctl restart apache2

No comments:

Post a Comment