Dev provisioning fails due to PHP version mismatch

hello all,

I have been using trellis to set up my bedrock/sage environments (dev, staging and production) for the last year or so, mostly without any big problems. Unfortunately, I have failed to successfully provision a new machine today, and other computers with working environments begin to fail if I attempt to reprovision.

Tasks run as expected up until TASK [composer : Install configured globally-required packages.], which fails with a non-zero return code. This forces composer to change to the /root/ dir and then triggers a Do not run Composer as root error.

Investigating this a bit, it seems it’s related to the PHP version that ansible is installing on the VM.

For this site we are currently using PHP 7.1 and all trellis’ roles are set with this version for both PHP and its modules (php7.1-mysql, etc). However, when I ssh into the recently (partially) provisioned box and run php --version, I get PHP 7.3.0RC3 (cli). If I ssh into another computer that has been set up prior to today, php --version's output is PHP 7.1.12-3+ubuntu16.04.1+deb.sury.org+1.

I am absolutely sure nothing has been done to trellis’ files in this site’s repo for the past few months and know for a fact that provisioning was working earlier today. Updating trellis and using PHP 7.2 does not seem to change the situation.

Could this be related to the 7.3RC3’s release last thursday? Or to ondrej’s PPA listing a packages as building and needs building?

Happy to have any input!

Also, here’s the full log of a failed provisioning, in case it is at all helpful:

TASK [composer : Install configured globally-required packages.] ***************
System info:
  Ansible 2.5.5; Vagrant 2.0.1; Darwin
  Trellis version (per changelog): "Allow customizing Nginx `worker_connections`"
---------------------------------------------------
non-zero return code
Changed current directory to /root/.composer
Do not run Composer as root/super user! See https://getcomposer.org/root for
details
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - hirak/prestissimo 0.3.8 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.3.7 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.3.6 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.3.5 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.3.4 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.3.3 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.3.2 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.3.1 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.3.0 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.2.4 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.2.3 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.2.2 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.2.1 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.2.0 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.1.9 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.1.8 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.1.7 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.1.6 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.1.5 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.1.4 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.1.3 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.1.2 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.1.18 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.1.17 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.1.16 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.1.15 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.1.14 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.1.13 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.1.12 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.1.11 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.1.10 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - hirak/prestissimo 0.1.1 requires ext-curl * -> the requested PHP
extension curl is missing from your system.
    - Installation request for hirak/prestissimo @stable -> satisfiable by
hirak/prestissimo[0.1.1, 0.1.10, 0.1.11, 0.1.12, 0.1.13, 0.1.14, 0.1.15,
0.1.16, 0.1.17, 0.1.18, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.1.7, 0.1.8,
0.1.9, 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.3.4,
0.3.5, 0.3.6, 0.3.7, 0.3.8].

  To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php/7.3/cli/php.ini
    - /etc/php/7.3/cli/conf.d/10-opcache.ini
    - /etc/php/7.3/cli/conf.d/10-pdo.ini
    - /etc/php/7.3/cli/conf.d/20-calendar.ini
    - /etc/php/7.3/cli/conf.d/20-ctype.ini
    - /etc/php/7.3/cli/conf.d/20-exif.ini
    - /etc/php/7.3/cli/conf.d/20-fileinfo.ini
    - /etc/php/7.3/cli/conf.d/20-ftp.ini
    - /etc/php/7.3/cli/conf.d/20-gettext.ini
    - /etc/php/7.3/cli/conf.d/20-iconv.ini
    - /etc/php/7.3/cli/conf.d/20-igbinary.ini
    - /etc/php/7.3/cli/conf.d/20-json.ini
    - /etc/php/7.3/cli/conf.d/20-msgpack.ini
    - /etc/php/7.3/cli/conf.d/20-phar.ini
    - /etc/php/7.3/cli/conf.d/20-posix.ini
    - /etc/php/7.3/cli/conf.d/20-readline.ini
    - /etc/php/7.3/cli/conf.d/20-shmop.ini
    - /etc/php/7.3/cli/conf.d/20-sockets.ini
    - /etc/php/7.3/cli/conf.d/20-sysvmsg.ini
    - /etc/php/7.3/cli/conf.d/20-sysvsem.ini
    - /etc/php/7.3/cli/conf.d/20-sysvshm.ini
    - /etc/php/7.3/cli/conf.d/20-tokenizer.ini
    - /etc/php/7.3/cli/conf.d/20-xdebug.ini
    - /etc/php/7.3/cli/conf.d/25-memcached.ini
  You can also run `php --ini` inside terminal to see which files are used by
PHP in CLI mode.

Installation failed, deleting ./composer.json.
failed: [default] (item={u'name': u'hirak/prestissimo'}) => {"changed": true, "cmd": ["/usr/local/bin/composer", "global", "require", "hirak/prestissimo:@stable", "--no-progress"], "delta": "0:00:02.596032", "end": "2018-10-15 15:44:40.079595", "item": {"name": "hirak/prestissimo"}, "rc": 2, "start": "2018-10-15 15:44:37.483563", "stderr_lines": ["Changed current directory to /root/.composer", "Do not run Composer as root/super user! See https://getcomposer.org/root for details", "./composer.json has been created", "Loading composer repositories with package information", "Updating dependencies (including require-dev)", "Your requirements could not be resolved to an installable set of packages.", "", "  Problem 1", "    - hirak/prestissimo 0.3.8 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.3.7 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.3.6 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.3.5 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.3.4 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.3.3 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.3.2 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.3.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.3.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.2.4 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.2.3 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.2.2 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.2.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.2.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.1.9 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.1.8 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.1.7 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.1.6 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.1.5 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.1.4 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.1.3 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.1.2 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.1.18 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.1.17 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.1.16 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.1.15 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.1.14 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.1.13 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.1.12 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.1.11 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.1.10 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - hirak/prestissimo 0.1.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.", "    - Installation request for hirak/prestissimo @stable -> satisfiable by hirak/prestissimo[0.1.1, 0.1.10, 0.1.11, 0.1.12, 0.1.13, 0.1.14, 0.1.15, 0.1.16, 0.1.17, 0.1.18, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5, 0.3.6, 0.3.7, 0.3.8].", "", "  To enable extensions, verify that they are enabled in your .ini files:", "    - /etc/php/7.3/cli/php.ini", "    - /etc/php/7.3/cli/conf.d/10-opcache.ini", "    - /etc/php/7.3/cli/conf.d/10-pdo.ini", "    - /etc/php/7.3/cli/conf.d/20-calendar.ini", "    - /etc/php/7.3/cli/conf.d/20-ctype.ini", "    - /etc/php/7.3/cli/conf.d/20-exif.ini", "    - /etc/php/7.3/cli/conf.d/20-fileinfo.ini", "    - /etc/php/7.3/cli/conf.d/20-ftp.ini", "    - /etc/php/7.3/cli/conf.d/20-gettext.ini", "    - /etc/php/7.3/cli/conf.d/20-iconv.ini", "    - /etc/php/7.3/cli/conf.d/20-igbinary.ini", "    - /etc/php/7.3/cli/conf.d/20-json.ini", "    - /etc/php/7.3/cli/conf.d/20-msgpack.ini", "    - /etc/php/7.3/cli/conf.d/20-phar.ini", "    - /etc/php/7.3/cli/conf.d/20-posix.ini", "    - /etc/php/7.3/cli/conf.d/20-readline.ini", "    - /etc/php/7.3/cli/conf.d/20-shmop.ini", "    - /etc/php/7.3/cli/conf.d/20-sockets.ini", "    - /etc/php/7.3/cli/conf.d/20-sysvmsg.ini", "    - /etc/php/7.3/cli/conf.d/20-sysvsem.ini", "    - /etc/php/7.3/cli/conf.d/20-sysvshm.ini", "    - /etc/php/7.3/cli/conf.d/20-tokenizer.ini", "    - /etc/php/7.3/cli/conf.d/20-xdebug.ini", "    - /etc/php/7.3/cli/conf.d/25-memcached.ini", "  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.", "", "Installation failed, deleting ./composer.json."], "stdout": "", "stdout_lines": []}
1 Like

I was able to get it to continue by running vagrant ssh and running the following commands:

sudo update-alternatives --set php /usr/bin/php7.2
sudo update-alternatives --set phar /usr/bin/phar7.2
sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.2
sudo update-alternatives --set phpize /usr/bin/phpize7.2
sudo update-alternatives --set php-config /usr/bin/php-config7.2

exit the vm and then running vagrant reload --provision.

Hope it helps :slight_smile:

4 Likes

Cheers, that also worked for me and is enough to move forward for the time being.

It definitely doesn’t seem like a definitive solution, though, as the whole point of trellis is to automate things, right?

Do you have any ideas about what might be causing this?

It seems at some step in the install process that php 7.3 is getting installed, not quite sure why but until its fixed the commands I previously posted will point to the older 7.2.

4 Likes

What does that mean for trellis? Does anything to happen on Root’s end, or is this an upstream solution to solve the problems here?

Everything should be fine again

2 Likes

Thanks for the update! I was looking for the PPA’s issue tracker but couldn’t find it.

Sods law that this happened the day I came back to Wordpress and Roots, I was tearing my hear out!

1 Like