PHP on Ubuntu Server
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.