ansible-role-php icon indicating copy to clipboard operation
ansible-role-php copied to clipboard

php8.0-json no installation candidate

Open dgibbs64 opened this issue 3 years ago • 9 comments

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 avatar Jan 28 '22 11:01 dgibbs64

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

dgibbs64 avatar Jan 31 '22 09:01 dgibbs64

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.

stale[bot] avatar May 01 '22 18:05 stale[bot]

Not stale

dgibbs64 avatar May 01 '22 19:05 dgibbs64

This issue is no longer marked for closure.

stale[bot] avatar May 01 '22 19:05 stale[bot]

I get the same error 👍

SolidRhino avatar May 24 '22 12:05 SolidRhino

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

dgibbs64 avatar Jun 10 '22 14:06 dgibbs64

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

ortzinator avatar Jun 23 '22 15:06 ortzinator

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

dgibbs64 avatar Jun 23 '22 18:06 dgibbs64

That's fair, just offering a workaround.

ortzinator avatar Jun 23 '22 20:06 ortzinator

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.

stale[bot] avatar Oct 15 '22 21:10 stale[bot]

bump

dgibbs64 avatar Oct 18 '22 16:10 dgibbs64

This issue is no longer marked for closure.

stale[bot] avatar Oct 18 '22 16:10 stale[bot]

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

plix1014 avatar Jan 08 '23 10:01 plix1014

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.

stale[bot] avatar May 22 '23 03:05 stale[bot]

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.

aimfireready avatar May 26 '23 14:05 aimfireready

This issue is no longer marked for closure.

stale[bot] avatar May 26 '23 14:05 stale[bot]

@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

dgibbs64 avatar May 26 '23 14:05 dgibbs64

@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.

aimfireready avatar May 27 '23 03:05 aimfireready