7

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
  • 117
  • 2
  • 7

2 Answers2

9

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
  • 49,021
  • 18
  • 212
  • 206
sushibrain
  • 2,614
  • 4
  • 32
  • 59
2

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
  • 21
  • 2