Trellis: Dev env PHP version issue

Created on 10 Oct 2020  路  8Comments  路  Source: roots/trellis

Description

Latest trellis dev environment PHP 8.0.0rc1 issue, it should be using the default PHP 7.4

Steps to reproduce

Follow the installation, create a project guide at https://roots.io/docs/trellis/master/installation/#create-a-project

TASK [composer : include_tasks] ************************************************
included: /home/vagrant/trellis/vendor/roles/composer/tasks/global-require.yml for default

TASK [composer : Install configured globally-required packages.] ***************
System info:
  Ansible 2.8.0; Vagrant 2.2.10; Linux
  Trellis version (per changelog): "Allow WP cron intervals to be configurable"
---------------------------------------------------
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.9 requires php ^5.3.2 || ^7.0 -> your PHP version
(8.0.0rc1) does not satisfy that requirement.
    - hirak/prestissimo 0.3.8 requires php ^5.3.2 || ^7.0 -> your PHP version
(8.0.0rc1) does not satisfy that requirement.
    - hirak/prestissimo 0.3.7 requires php ^5.3.2 || ^7.0 -> your PHP version
(8.0.0rc1) does not satisfy that requirement.
    - hirak/prestissimo 0.3.6 requires php ^5.3.2 || ^7.0 -> your PHP version
(8.0.0rc1) does not satisfy that requirement.
    - hirak/prestissimo 0.3.5 requires php ^5.3.2 || ^7.0 -> your PHP version
(8.0.0rc1) does not satisfy that requirement.
    - hirak/prestissimo 0.3.4 requires php ^5.3.2 || ^7.0 -> your PHP version
(8.0.0rc1) does not satisfy that requirement.
    - hirak/prestissimo 0.3.3 requires php ^5.3.2 || ^7.0 -> your PHP version
(8.0.0rc1) does not satisfy that requirement.
    - hirak/prestissimo 0.3.2 requires php ^5.3.2 || ^7.0 -> your PHP version
(8.0.0rc1) does not satisfy that requirement.
    - hirak/prestissimo 0.3.10 requires php ^5.3.2 || ^7.0 -> your PHP
version (8.0.0rc1) does not satisfy that requirement.
...

Default PHP is as followed

vagrant@example:~$ php -v
PHP 8.0.0rc1 (cli) (built: Oct 10 2020 19:46:07) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.0rc1, Copyright (c), by Zend Technologies

PHP 7.4 is installed but not as default.

vagrant@example:~$ php7.4 -v
PHP 7.4.11 (cli) (built: Oct 10 2020 19:44:50) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.11, Copyright (c), by Zend Technologies

Most helpful comment

Same error when provisioning remote servers.

Edit:

Workaround:

ssh into your server/VM
sudo update-alternatives --set php /usr/bin/php7.4 (or an older version if you鈥檙e not on Trellis >=v1.4.0 yet)
Confirm with php -v
Provision again.

All 8 comments

Same error when provisioning remote servers.

Edit:

Workaround:

ssh into your server/VM
sudo update-alternatives --set php /usr/bin/php7.4 (or an older version if you鈥檙e not on Trellis >=v1.4.0 yet)
Confirm with php -v
Provision again.

@RawDawg Thanks that works as a temporary measure. It saved me some time this morning 馃帀

I'm confused how PHP 8 is set as default because it's a release candidate, Ubuntu should only set a stable release as default.

I can confirm the issue and the sudo update-alternatives --set php /usr/bin/php7.4 workaround works.

@swalkinshaw Any idea why/how PHP 8.0.0rc1 being installed?

I'm getting the same 馃

The PPA just published PHP 8.0 3 days ago: https://github.com/oerdnj/deb.sury.org/issues/1439#issuecomment-705578682

The 7.4 packages were updated recently too: https://launchpad.net/%7Eondrej/+archive/ubuntu/php/+index?batch=75&memo=225&start=225

So my only guess right now is its an upstream bug in the PPA. Trellis specifics the explicit version in the package name...

In composer.json it specifies the php version as greater than 7.1. Maybe that is the issue.

In composer.json it specifies the php version as greater than 7.1. Maybe that is the issue.

I changed it to 7.4(from >=7.1), the problem persisted.

Same error when provisioning remote servers.

Edit:

Workaround:

ssh into your server/VM
sudo update-alternatives --set php /usr/bin/php7.4 (or an older version if you鈥檙e not on Trellis >=v1.4.0 yet)
Confirm with php -v
Provision again.

This worked for me

Composer just validates the required PHP version. The problem is its being installed when it shouldn't which is coming from the PPA.

This comment specifically matches what I'm seeing. Every version is being installed and then because PHP 8 exists, Composer fails its check.

At least I think that's the problem so far

At some ponit I would really like to switch over to PHP 8, at least for some sites.
Apparently one has to use pickle instead of PECL for PHP 8?
And I had issues with installing the PHP imagemagick extension and xdebug (on development) for PHP 8.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

connerbw picture connerbw  路  9Comments

pajtai picture pajtai  路  3Comments

swalkinshaw picture swalkinshaw  路  4Comments

DinisCruz picture DinisCruz  路  7Comments

retlehs picture retlehs  路  4Comments