PHP on Ubuntu Server

PHP, Hypertext Preprocessor, is used for web development, a server-side scripting language interacting with databases, read more here. PHP is also a part of the LAMP-stack.

Let’s start by updating the package manager cache, run the command “sudo apt update

To install PHP, run the command “sudo apt install php

To install PHP as part of the popular LAMP-stack, run the command “sudo apt install php php-mysql”, make sure that “libapache2-mod-php” is mentioned under “The following additional packages will be installed”
The LAMP-stack contains Linux, Apache, MySQL, and PHP, click on each for tutorials on installing them.

Type “y” to continue

Run the command “php -v” to see the PHP version

Now PHP is installed, as well as modules making it possible for PHP to communicate with MySQL databases and for Apache to handle PHP files.