Skip to content

Instantly share code, notes, and snippets.

@rasmuscnielsen
Forked from wimarbueno/mamp-php-gmp.md
Last active January 31, 2025 08:51
Show Gist options
  • Save rasmuscnielsen/8b95edaab6e1fe20cd9ef427d3ae23c6 to your computer and use it in GitHub Desktop.
Save rasmuscnielsen/8b95edaab6e1fe20cd9ef427d3ae23c6 to your computer and use it in GitHub Desktop.
How to install GMP extension for PHP 7.4.2 using MAMP

Installing GMP extension for PHP 7.4 using MAMP

You have to build the GMP extension from the PHP source code. First install Autoconf and GMP using Homebrew.

brew install autoconf gmp

Download and unpack PHP.

http://php.net/get/php-7.4.2.tar.bz2/from/a/mirror

$ cd php-7.4.2/ext/gmp
$ /Applications/MAMP/bin/php/php7.4.2/bin/phpize
$ ./configure --with-php-config=/Applications/MAMP/bin/php/php7.4.2/bin/php-config
$ make
$ make install

Add the extension loading config to php.ini in /Applications/MAMP/bin/php/php7.4.2/conf.

extension=gmp.so

Restart MAMP servers and verify extension is loaded in the phpinfo() report.

@DaanRG
Copy link

DaanRG commented Jan 31, 2025

This worked @tomhapbia, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment