1 min read
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 deb.sury.org.
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 https://packages.sury.org/php/apt.gpg echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list sudo apt-get update sudo apt-get install php7.2-cli
sudo apt-get install apache2
sudo apt-get install postgresql postgresql-client
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
http://localhost:8000/ in your browser to access it.