geerlingguy / ansible-role-php

Ansible Role - PHP
https://galaxy.ansible.com/geerlingguy/php/
MIT License
492 stars 442 forks source link

php8.0-json no installation candidate #358

Closed dgibbs64 closed 1 year ago

dgibbs64 commented 2 years ago

Re opening based off this issue that went stale https://github.com/geerlingguy/ansible-role-php/issues/323

php-json package is no longer necessary for PHP 8.0: reference Because php-json is included in default __php_packages list for Debian-based distributions, installation fails:

E: Package 'php8.0-json' has no installation candidate Solution: install php{{ php_default_version_debian }}-json package only when php_default_version_debian less than 8.0

Failure output

TASK [geerlingguy.php : Ensure PHP packages are installed.] ********************
fatal: [forest-tools.com]: FAILED! => {
    "cache_update_time": 1643369106,
    "cache_updated": false,
    "changed": false,
    "rc": 100
}

STDOUT:

Reading package lists...
Building dependency tree...
Reading state information...
Package php8.0-json is a virtual package provided by:
  php8.0-phpdbg 8.0.14-1+ubuntu20.04.1+deb.sury.org+1
  php8.0-fpm 8.0.14-1+ubuntu20.04.1+deb.sury.org+1
  php8.0-cli 8.0.14-1+ubuntu20.04.1+deb.sury.org+1
  php8.0-cgi 8.0.14-1+ubuntu20.04.1+deb.sury.org+1
  libphp8.0-embed 8.0.14-1+ubuntu20.04.1+deb.sury.org+1
  libapache2-mod-php8.0 8.0.14-1+ubuntu20.04.1+deb.sury.org+1

STDERR:

E: Package 'php8.0-json' has no installation candidate

MSG:

'/usr/bin/apt-get -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold"       install 'php8.0-common' 'php8.0-cli' 'php8.0-dev' 'php8.0-fpm' 'libpcre3-dev' 'php8.0-gd' 'php8.0-curl' 'php8.0-imap' 'php8.0-json' 'php8.0-opcache' 'php8.0-xml' 'php8.0-mbstring' 'php-sqlite3' 'php-apcu' 'php8.0-curl' 'php8.0-xml' 'php8.0-zip' -o APT::Install-Recommends=no' failed: E: Package 'php8.0-json' has no installation candidate
dgibbs64 commented 2 years ago

I have done a dirty workaround to get past the issue. Effecting 8.0 and 8.1 https://github.com/dgibbs64/ansible-role-php

stale[bot] commented 2 years ago

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

dgibbs64 commented 2 years ago

Not stale

stale[bot] commented 2 years ago

This issue is no longer marked for closure.

SolidRhino commented 2 years ago

I get the same error 👍

dgibbs64 commented 2 years ago

I can confirm that php-json is not required in php 8 as it is now built-in to php https://php.watch/versions/8.0/ext-json

ortzinator commented 2 years ago

The php_versions role fixes this. If you're using php_versions via the php_roles collection, be aware that the collection hasn't been updated in two years and is using an old version of all of its roles geerlingguy/ansible-collection-php_roles#9

dgibbs64 commented 2 years ago

The issue still remains you can't install php8 with this role. The purpose of this role is to install versions of PHP.

ortzinator commented 2 years ago

That's fair, just offering a workaround.

stale[bot] commented 1 year ago

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

dgibbs64 commented 1 year ago

bump

stale[bot] commented 1 year ago

This issue is no longer marked for closure.

plix1014 commented 1 year ago

see also https://github.com/geerlingguy/ansible-role-php/issues/380#issuecomment-1374798469

stale[bot] commented 1 year ago

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

aimfireready commented 1 year ago

According to this answer on Stack Exchange: Version 8 has moved json into core code and it is no longer a separate module.

So, near as I can tell, there is no solution because, actually, there is no problem.

stale[bot] commented 1 year ago

This issue is no longer marked for closure.

dgibbs64 commented 1 year ago

@aimfireready the problem is that this role tries to install php8.0-json which doesn't exist for php 8 causing the role to fail if anyone trys to install php 8 with this role. So there definitely is a problem and a solution

aimfireready commented 1 year ago

@dgibbs64 ahh, I see that now. I'm not familiar with Ansible. I thought this was a more general PHP issue. Sorry for the mixup.

In my case--a boring ole' Ubuntu VPS--skipping the attempt to install the JSON module fixed the issue. Maybe there's an equivalent way to "skip" that step in Ansible. I hope you figure it out.