Install PHP from prebuilt packages on Debian with Caddy and PostgreSQL

Installing PHP on Debian

To install the latest, stable PHP on Debian Stretch (Debian 9) or Jessie (Debian 8), you should look into Ondřej Surý's Debian packages at

Here are a quick and simple instructions to get up and running fast:

sudo apt-get install apt-transport-https lsb-release ca-certificates
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg
echo "deb $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
sudo apt-get update
sudo apt-get install php7.2-cli

Install PostgreSQL

sudo apt-get install postgresql postgresql-client

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.