Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

PHP 7.3 CLI installed in addition to 7.1, breaks stuff. #1963

Closed
ndouglas opened this issue Aug 28, 2019 · 13 comments
Closed

PHP 7.3 CLI installed in addition to 7.1, breaks stuff. #1963

ndouglas opened this issue Aug 28, 2019 · 13 comments

Comments

@ndouglas
Copy link

Issue Type

  • Bug Report / Support Request

Your Environment

Vagrant 2.2.4
VirtualBox 5.2.32r132073

Your OS

  • macOS 10.12.6

Full console output

https://gist.github.com/ndouglas/253528c85a35aca7b37f6ce7ae579478

Summary

php7.3-cli seems to get installed in addition to php7.1-cli.

vagrant@drupal8:/var/www/drupalvm/docroot$ php -v
PHP 7.3.8-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Aug  7 2019 09:52:12) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.8, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.8-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

This happens despite using the default php_version of "7.1" in my config.yml (and not overridden in my local.config.yml).

This is a recent issue, only experienced by myself (and a coworker) when trying to get him set up with DrupalVM.

Since my extras, etc aren't installed for PHP 7.3, scripts fail. For instance, Drupal installation fails because there's no appropriate installation of pdo_mysql. I suspect this might also be the cause behind #1962 and #1961 and #1903 (latest comments) and possibly others.

If I simply do sudo apt-get remove php7.3-cli, the package is removed and everything works fine.

I've poked around a small bit, but I haven't yet managed to figure out why the package is installed. sudo aptitude why php7.3-cli seems to blame php-yaml, but I suspect it's more complicated than that.

@geerlingguy
Copy link
Owner

geerlingguy commented Aug 29, 2019

Hmm this looks like it's related to #1964 also

@geerlingguy
Copy link
Owner

If it is related to php-yaml, that package should be installed at the proper version too...

@geerlingguy
Copy link
Owner

If I set php_version: 7.1 then I fail with a default installation at:

TASK [geerlingguy.drupal : Generate Drupal project with composer package in /tmp/composer-project (this may take a while).] ***
fatal: [drupalvm]: FAILED! => changed=true 
  cmd:
  - /usr/bin/composer
  - create-project
  - drupal-composer/drupal-project:8.x-dev
  - /tmp/composer-project
  - --prefer-dist
  - --stability
  - dev
  - --no-interaction
  delta: '0:01:08.036615'
  end: '2019-08-29 14:51:16.280006'
  msg: non-zero return code
  rc: 2
  start: '2019-08-29 14:50:08.243391'
  stderr: |-
    Error: "curl" PHP extension not loaded; Prestissmo Composer plugin disabled.
    Error: "curl" PHP extension not loaded; Prestissmo Composer plugin disabled.
    Installing drupal-composer/drupal-project (8.x-dev ec0f41171516c18357ca4cda9068ee4cdeabaa19)
      - Installing drupal-composer/drupal-project (8.x-dev ec0f411): Downloading (connecting...)Downloading (100%)
    Created project in /tmp/composer-project
    Error: "curl" PHP extension not loaded; Prestissmo Composer plugin disabled.
    > DrupalProject\composer\ScriptHandler::checkComposerVersion
    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
        - drupal/core 8.8.x-dev requires ext-dom * -> the requested PHP extension dom is missing from your system.
        - drupal/core 8.7.x-dev requires ext-dom * -> the requested PHP extension dom is missing from your system.
        - drupal/core 8.7.6 requires ext-dom * -> the requested PHP extension dom is missing from your system.
        - drupal/core 8.7.5 requires ext-dom * -> the requested PHP extension dom is missing from your system.
        - drupal/core 8.7.4 requires ext-dom * -> the requested PHP extension dom is missing from your system.
        - drupal/core 8.7.3 requires ext-dom * -> the requested PHP extension dom is missing from your system.
        - drupal/core 8.7.2 requires ext-dom * -> the requested PHP extension dom is missing from your system.
        - drupal/core 8.7.1 requires ext-dom * -> the requested PHP extension dom is missing from your system.
        - drupal/core 8.7.0-rc1 requires ext-dom * -> the requested PHP extension dom is missing from your system.
        - drupal/core 8.7.0-beta2 requires ext-dom * -> the requested PHP extension dom is missing from your system.
        - drupal/core 8.7.0-beta1 requires ext-dom * -> the requested PHP extension dom is missing from your system.
        - drupal/core 8.7.0-alpha2 requires ext-dom * -> the requested PHP extension dom is missing from your system.
        - drupal/core 8.7.0-alpha1 requires ext-dom * -> the requested PHP extension dom is missing from your system.
        - drupal/core 8.7.0 requires ext-dom * -> the requested PHP extension dom is missing from your system.
        - Installation request for drupal/core ^8.7.0 -> satisfiable by drupal/core[8.7.0, 8.7.0-alpha1, 8.7.0-alpha2, 8.7.0-beta1, 8.7.0-beta2, 8.7.0-rc1, 8.7.1, 8.7.2, 8.7.3, 8.7.4, 8.7.5, 8.7.6, 8.7.x-dev, 8.8.x-dev].
  
      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-apcu.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-json.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-yaml.ini
      You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
  stderr_lines: <omitted>
  stdout: ''
  stdout_lines: <omitted>

Trying PHP 7.2 next.

@geerlingguy
Copy link
Owner

With php_version: 7.2, there are no problems.

So maybe upstream in ondrej's repo, there's an issue with one of the 7.1 packages causing 7.3 to also be installed...

@geerlingguy
Copy link
Owner

I'm troubleshooting the 7.1 install:

# apt list --installed | grep php

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

php-apcu/bionic,now 5.1.17+4.0.11-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]
php-common/bionic,bionic,now 2:69+ubuntu18.04.1+deb.sury.org+2+php7.3 all [installed,automatic]
php-yaml/bionic,now 2.0.4+1.3.2-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]
php7.1/bionic,bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 all [installed]
php7.1-cli/bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]
php7.1-common/bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]
php7.1-curl/bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]
php7.1-dev/bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]
php7.1-fpm/bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]
php7.1-gd/bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]
php7.1-imap/bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]
php7.1-json/bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]
php7.1-mbstring/bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]
php7.1-mysql/bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]
php7.1-opcache/bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]
php7.1-readline/bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed,automatic]
php7.1-sqlite3/bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]
php7.1-xml/bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]
php7.3-cli/bionic,now 7.3.8-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed,automatic]
php7.3-common/bionic,now 7.3.8-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed,automatic]
php7.3-json/bionic,now 7.3.8-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed,automatic]
php7.3-opcache/bionic,now 7.3.8-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed,automatic]
php7.3-phpdbg/bionic,now 7.3.8-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed,automatic]
php7.3-readline/bionic,now 7.3.8-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed,automatic]

# apt-get install -y aptitude

# aptitude why php-common
i   php7.1-xml Depends php-common (>= 1:35)

# aptitude why php7.3-common
i   php-yaml      Depends  phpapi-20180731 | phpapi-20170718 | phpapi-20160303 | phpapi-20151012 | phpapi-20131226
i A php7.3-phpdbg Provides phpapi-20180731                                                                        
i A php7.3-phpdbg Depends  php7.3-common (= 7.3.8-1+ubuntu18.04.1+deb.sury.org+1) 

So it looks like php7.1-xml depends on php-common, which results in the package being installed, which in Bionic is actually php7.3-common...?

@geerlingguy
Copy link
Owner

To verify it's the xml package, I set the following in my local.config.yml and re-provisioned:

php_packages:
  - "php{{ php_version }}"
  - "php{{ php_version }}-apcu"
  - "php{{ php_version }}-cli"
  - "php{{ php_version }}-common"
  - "php{{ php_version }}-curl"
  - "php{{ php_version }}-dev"
  - "php{{ php_version }}-fpm"
  - "php{{ php_version }}-gd"
  - "php{{ php_version }}-imap"
  - "php{{ php_version }}-json"
  - "php{{ php_version }}-mbstring"
  - "php{{ php_version }}-opcache"
  - "php{{ php_version }}-sqlite3"
  # - "php{{ php_version }}-xml"
  - "php{{ php_version }}-yaml"

But now:

# aptitude why php-common
i   php7.1-sqlite3 Depends php-common (>= 1:35)

Hmm... so:

# aptitude why php7.3-cli
i   php-yaml   Depends  phpapi-20180731 | phpapi-20170718 | phpapi-20160303 | phpapi-20151012 | phpapi-20131226
i A php7.3-cli Provides phpapi-20180731

# aptitude why php-yaml
Manually installed, current version 2.0.4+1.3.2-1+ubuntu18.04.1+deb.sury.org+1, priority optional
No dependencies require to install php-yaml

So it looks like the YAML extension might be the problem.

@geerlingguy
Copy link
Owner

geerlingguy commented Aug 29, 2019

Weird, if I take php{{ php_version }}-yaml out of the list, it is still installed (well at least php-yaml is...).

Still get:

# aptitude why php-yaml
Manually installed, current version 2.0.4+1.3.2-1+ubuntu18.04.1+deb.sury.org+1, priority optional
No dependencies require to install php-yaml

@geerlingguy
Copy link
Owner

So this is strange... I noticed that libapache2-mod-php7.1 was also installed... apparently php7.1 depends on it?!

$ aptitude why libapache2-mod-php7.1
i   php7.1 Depends libapache2-mod-php7.1 | php7.1-fpm | php7.1-cgi

@geerlingguy
Copy link
Owner

It is not required in PHP 7.2 or 7.3... weird.

@geerlingguy
Copy link
Owner

At first I thought it was definitely a bug in Ondrej's repos, but looking twice, it seems like the problem might be that when my php-versions role runs:

# apt-get purge php7.2-common (and 7.3, etc.—all versions that are not the current `php_version`)

That still results in one leftover package being installed:

# apt list --installed | grep php

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

php-common/bionic,bionic,now 2:69+ubuntu18.04.1+deb.sury.org+2+php7.3 all [installed,auto-removable]

So I'm going to see if I can make it so it also purges php-common by name if it purged anything in the previous run...

@geerlingguy
Copy link
Owner

It looks like my fix may have worked:

$ apt list --installed | grep php

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

php-apcu/bionic,now 5.1.17+4.0.11-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]
php-common/bionic,bionic,now 2:69+ubuntu18.04.1+deb.sury.org+2+php7.3 all [installed,automatic]
php-yaml/bionic,now 2.0.4+1.3.2-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]
php7.1/bionic,bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 all [installed]
php7.1-cli/bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]
php7.1-common/bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]
php7.1-curl/bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]
php7.1-dev/bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]
php7.1-fpm/bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]
php7.1-gd/bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]
php7.1-imap/bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]
php7.1-json/bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]
php7.1-mbstring/bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]
php7.1-opcache/bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]
php7.1-readline/bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed,automatic]
php7.1-sqlite3/bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]
php7.1-xml/bionic,now 7.1.31-1+ubuntu18.04.1+deb.sury.org+1 amd64 [installed]

So now I need to fix it upstream in geerlingguy.php-versions...

@geerlingguy
Copy link
Owner

Opened upstream issue geerlingguy/ansible-role-php-versions#41 — testing there.

@geerlingguy
Copy link
Owner

Everything in that issue seems to check out. If tests pass, I'll tag a new release, then update Drupal VM, then I think I can close out all these PHP 7.1-related issues!

dhaley pushed a commit to NREL/drupal-vm that referenced this issue Sep 4, 2019
…eerlingguy#1964: Purge php-common package when installing different PHP version.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants