1

When updating pi-hole I got a message:

Checking for php8.0-intl (will be installed)
Processing apt-get install(s) for: php8.0-cgi php8.0-json php8.0-intl, please wait...

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

Recently I installed php8.0 on my Raspberry Pi 4 running Ubuntu 20.04 LTS. I did apt update & upgrade, but the php8.0-json is still not available. Anyway, Pi-hole still works flawlessly, but I cannot update. Is there a way to install this json ?

1

Version 8 has moved json into core code and it is no longer a separate module.

Full details can be seen on PHP Watch here

As for getting PiHole running fully, you may find their forum more help as it's not a Pi specific program / issue as PHP 8 is not shipped by default yet.

Edit:

To install php 8.0 add the repository:

sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
sudo apt update

Then install the base and cli:

sudo apt install -y php8.0-common php8.0-cli

Then install the required modules:

sudo apt install -y php8.0-extension_name

e.g. for cURL and zip:

sudo apt install -y php8.0-curl php8.0-zip

For Apache use one / both of:

sudo apt install -y libapache2-mod-php8.0
sudo apt install -y php8.0-fpm

Full changed details start at this page

BE WARNED

  1. The above does not replace earlier versions and may cause your scripts to fail if they are version dependant. You should remove earlier versions of PHP first using sudo apt purge '^php7.x.*' where 'x' is the sub-version of 7 installed (often 7.3 on Zeros and 7.4 on 2+ boards)
  2. I have not tried both versions together, nor have I tried sudo update-alternatives --config php to switch between them.
  3. I do not believe v8.x will run on early ARMv6 chip sets (e.g. Pi 1 / zero / zero W) - you would need to compile the source yourself.

Note:

  • There is no JSON component now as it's built in so any references to the file php8.0-json will ERROR.
  • Checks within PHP scripts for the module being loaded using extension_loaded('json') or function_exists('json_decode') will PASS
  • See here for full details
0

On the Raspberry Pi forum I found this solution: https://discourse.pi-hole.net/t/pihole-5-php-8/44609 (German).

I uninstalled PHP 8, did update Pihole (pihole -up) successfully and kicked the RP 4 and after the reboot it ran flawlessly using PHP 7.4.

Is there a way to install a complete PHP 8 with builtin JSON ?

1
  • I've added notes on installing PHP 8.0 for you. – user130616 Apr 24 at 9:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.