How to Install PHP on Debian 9

How to Install PHP on Debian 9
How to Install PHP on Debian 9

Install PHP on Debian 9

PHP is one of the most popular programming language currently in the world. PHP has different versions 5.6, 7.0, 7.1 and 7.2. Debian 9 is the current latest version of Debian. This tutorial outlines how to install PHP on Debian 9.

Prerequisites

Before you start installing PHP on Debian 9. You must have a non-root user account on your server with sudo privileges.

How to Install PHP 7.0 on Debian 9

Update the apt package manager index typing following command:

sudo apt update

Run the following command to install PHP on your server. The following command will install php7.2.

sudo apt install php7.0

Check PHP version and confirm the installation by running following command

php -v

Following are some basic PHP extensions needs to be installed on your server

sudo apt install php7.0-curl php7.0-mysql php7.0-common php7.0-cli php7.0-gd php7.0-opcache

How to Install PHP 7.2 on Debian 9

Update the apt package manager index typing following command:

sudo apt update

Run the following command to install PHP on your server. The following command will install php7.2.

sudo apt install php7.2

Check PHP version and confirm the installation by running following command

php -v

Following are some basic PHP extensions needs to be installed on your server

sudo apt install php7.2-curl php7.2-mysql php7.2-common php7.2-cli php7.2-gd php7.2-opcache

Conclusion

In this tutorial, you have learned how to install PHP on Debian 9 successfully with some of its basic extensions useful for frameworks and tested successfully. If you have any of the queries regarding this then you can comment below.

LEAVE A REPLY

Please enter your comment!
Please enter your name here