8

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?

Dharman
  • 30,962
  • 25
  • 85
  • 135
Jaeger
  • 1,686
  • 1
  • 30
  • 50
  • When you say the same command works except for JSON, do you mean that it works when you just run `RUN docker-php-ext-install mysqli pdo pdo_mysql`? – Chris Haas Dec 11 '20 at 17:34
  • Yes, exactly. It runs smoothly but the moment I try to do the same with json, I get the error. – Jaeger Dec 11 '20 at 17:36
  • Oh so that must be the reason why I can't install it... because it's already installed. – Jaeger Dec 11 '20 at 17:40
  • Yes it's working, I just tried to use `json_decode` and `json_encode`, my IDE asked me to add "ext-json" in the composer.json file, but that excepted, it works fine – Jaeger Dec 11 '20 at 18:15

1 Answers1

30

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

Chris Haas
  • 53,986
  • 12
  • 141
  • 274