JSON with PHP 8.0


Like read in this page in need to install JSON with Drupal 9.x and PHP 8.0

Here is what I have already installed, or not:

[email protected]:~# dpkg -l *-json* | grep ii
ii  php5.6-json    5.6.40-57+ubuntu20.04.1+deb.sury.org+1 amd64        JSON module for PHP
ii  php7.0-json    7.0.33-57+ubuntu20.04.1+deb.sury.org+1 amd64        JSON module for PHP
ii  php7.1-json    7.1.33-44+ubuntu20.04.1+deb.sury.org+1 amd64        JSON module for PHP
ii  php7.2-json    7.2.34-28+ubuntu20.04.1+deb.sury.org+1 amd64        JSON module for PHP
ii  php7.3-json    7.3.33-1+ubuntu20.04.1+deb.sury.org+1  amd64        JSON module for PHP
ii  php7.4-json    7.4.27-1+ubuntu20.04.1+deb.sury.org+1  amd64        JSON module for PHP
[email protected]:~# apt install php8.0-json
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php8.0-json is a virtual package provided by:
  php8.0-phpdbg 8.0.15-1+ubuntu20.04.1+deb.sury.org+1
  php8.0-fpm 8.0.15-1+ubuntu20.04.1+deb.sury.org+1
  php8.0-cli 8.0.15-1+ubuntu20.04.1+deb.sury.org+1
  php8.0-cgi 8.0.15-1+ubuntu20.04.1+deb.sury.org+1
  libphp8.0-embed 8.0.15-1+ubuntu20.04.1+deb.sury.org+1
  libapache2-mod-php8.0 8.0.15-1+ubuntu20.04.1+deb.sury.org+1
You should explicitly select one to install.

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

So what I shloud do to install it? I don’t whant to break something (HestiaCP default install on a Ubuntu 20.04.x)



Is installed by default

Oh, ok @eris
So the requirements for PHP 8 is ok, if I read this page: https://www.drupal.org/docs/system-requirements/php-requirements ?

Here is the problem I have in Drupal 9.x and PHP 8.0 : With PHP 8, BCC and CC are not sent as a mail [#3254828] | Drupal.org


Drupal 9 and higher require PHP compiled with JSON. JSON support is normally compiled as part of PHP core, but in case you’re getting errors like PHP Fatal error: Call to undefined function Drupal\\Component\\Serialization\\json_encode() in ... core/lib/Drupal/Component/Serialization/Json.php try adding the JSON extension.

So it is installed on default no need to install additional php packages

For Email I have no idea.

apt install -y php8.0-{common,xml,zip,mysql,curl,mbstring,gd,intl,xsl,bcmath,imap,soap,readline,sqlite3,gmp}

systemctl restart php8.0-fpm

That should cover 99.99% of all PHP extensions a modern framework would use.

I assume it under the wrong topic :slight_smile:

v-add-web-php x.x should do the trick swell

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.