Published on

Switch Between Multiple PHP Versions on Linux

How to switch between multiple php versions using the command line on Ubuntu/Linux.

Before getting started, make sure you have:

  • A running Ubuntu/Linux system (or any of its derivatives)
  • Multiple PHP versions already installed on your system

We can use the following command:

sudo update-alternatives --config php