11

I'm having troubble installing the gmp extension on my docker image. My docker file looks like:

FROM php:7.4-fpm-alpine 

RUN docker-php-ext-install pdo pdo_mysql gmp

When I run this docker file I get the error:

configure: error: GNU MP Library version 4.2 or greater required.
ERROR: Service 'php' failed to build : The command '/bin/sh -c docker-php-ext-install pdo pdo_mysql gmp' returned a non-zero code: 1

I've tried the solution on this stackoverflow post, however it did not work for me.

Any ideas on how I can resolve this?

DriedSponge
  • 176
  • 3
  • 10

2 Answers2

13

Like the error says: configure: error: GNU MP Library version 4.2 or greater required.

You can install GNU MP (GMP for short) on Alpine Linux by including the following in your Dockerfile:

RUN apk add gmp-dev

(or RUN apt-get install gmp-dev for other debian distros)

T.Todua
  • 53,146
  • 19
  • 236
  • 237
sushibrain
  • 2,712
  • 5
  • 33
  • 62
6

I spent half an hour on this, so just to clarify for anyone that is looking for a solution: adding these lines to the Dockerfile for php7.4 worked:

RUN apt-get install -y libgmp-dev
RUN docker-php-ext-install gmp
Jurriën
  • 61
  • 1
  • 2