Search code examples
phpjsondockerphp-8

Unable to install the JSON extension in PHP's docker image


I recently started to upgrade my projects from PHP 7.4 to 8.0, and I'm currently trying to rebuild all my Docker images to PHP 8.0 as well so both my images and my environment are coherent.

Before this upgrade, I was using php:7.4, and inside my Dockerfile, I had this line for the extensions installation:

RUN docker-php-ext-install mysqli pdo pdo_mysql json

Today, the same command works EXCEPT for JSON, where I get the following error:

Installing shared extensions:     /usr/local/lib/php/extensions/no-debug-non-zts-20200930/
cp: cannot stat 'modules/*': No such file or directory
make: *** [Makefile:87: install-modules] Error 1

I can't find anyone else with this problem on Stack Overflow or the web in general, so... Has the name changed, or is it not required anymore? Or is it even normal?


Solution

  • In PHP 8 the JSON extension was made "always available" so there isn't a need to manually install it anymore.