Install PHP from prebuilt packages on Ubuntu with OpenLiteSpeed and MariaDB

Installing PHP on Ubuntu

Official package on Ubuntu is usually recommeended but there is a better way to get the latest stable PHP using Ondřej Surý PHP packages:

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.2

Install OpenLiteSpeed

wget -O - | bash
sudo apt-get install openlitespeed

Install MariaDB

Development on localhost using built-in web server

If you're developing PHP applications on your local workstation, PHP also has a useful built-in web server for localhost development. It is not intended to be used for production environments.

Inside your project folder you can run it from the command line using PHP CLI SAPI:

php -S localhost:8000

Visit http://localhost:8000/ in your browser to access it.