Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing GMP extention on PHP 7.4 FPM Aplpine (Docker)

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?

like image 278
DriedSponge Avatar asked Nov 05 '20 18:11

DriedSponge


People also ask

What is GMP PHP?

GMP stands for GNU Multiple Precision Arithmetic Library (GMP). GMP is a library supported in PHP that allows you to do mathematical operations on signed integers, rational numbers, and floating point numbers. GMP has a rich collection of functions that helps to perform complex mathematical operations on big numbers.

Does Docker install PHP?

You don't need to make any changes to the PHP or NGINX configuration on the new server. You don't even need to install PHP or NGINX on the server itself. They'll be automatically installed by Docker when you launch the application. You can run the exact same image on your development machine.

Can I install PHP 7 4 on Docker?

Installing PHP 7.4 On Docker. With the release of PHP 7.4 (today)… | by Devin Dixon | Helium MVC | Medium With the release of PHP 7.4 (today), the language has some great updates that can improve development. These changes include: Many more… You may want to get it running on your local docker before deploying to production.

What Docker version do I need to update to 2750?

You are hitting what opencontainers/runc#2750 fixes, so you need an updated docker; 20.10.4 and above includes the updated runc. Sorry, something went wrong. Looks like you are all running into the exact issue our build servers were hitting last week.

What version of GNU MP library is required for Alpine Linux?

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:


Video Answer


2 Answers

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)

like image 63
sushibrain Avatar answered Dec 22 '22 21:12

sushibrain


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
like image 39
Jurriën Avatar answered Dec 22 '22 22:12

Jurriën