Your PHP version (7.3.1) does not satisfy that requirement [Homestead]

Illia Sakovich

January 21, 2019

Recently I updated Homestead to the latest version.

Then I tried to install composer depenpencies for one of my projects but faced such problem:

vagrant@homestead:~/projects/blog$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.

 Problem 1
   - Installation request for friendsofphp/php-cs-fixer v2.13.1 -> satisfiable by friendsofphp/php-cs-fixer[v2.13.1].
   - friendsofphp/php-cs-fixer v2.13.1 requires php ^5.6 || >=7.0 <7.3 -> your PHP version (7.3.1) does not satisfy that requirement.

Obviously, I needed to downgrade PHP to the previous version, but had no idea how to do it in Homestead.

After some investigation I've found the solution to change PHP version inside Homestead. And it's pretty simple:

vagrant@homestead:~/projects/blog$ sudo update-alternatives --config php
There are 3 choices for the alternative php (providing /usr/bin/php).

 Selection    Path             Priority   Status
 0            /usr/bin/php7.3   73        auto mode
 1            /usr/bin/php7.1   71        manual mode
 2            /usr/bin/php7.2   72        manual mode
* 3            /usr/bin/php7.3   73        manual mode
Illia Sakovich

Written by

Illia Sakovich

Founder of Coderello, full-stack developer.