10

Using OS X 10.11.1 (El Capitan) and PHP 5.5.29.

I would like to add the GMP extension to my PHP, but I have no clue to do so. According to the PHP manual I'm supposed compile PHP with a --with-gmp=dir option. But I don't know how to compile PHP (I doubt if I ever did it on this machine, iirc it just came with PHP by default), and I don't know what dir to use with that --with-gmp= option either.

I do have Homebrew, and I noticed a rather old old similar question however that doesn't seem to work (package no longer available).

I noticed in brew there is something called homebrew/php/php55-gmp but that suggests to something with brew tap. I have no clue what that is, and I'd rather not mess up my Homebrew config or my entire development environment (I guess that's unlikely, but I have no idea what I'm doing to my system when I mess with this tap stuff).

Community
  • 1
  • 1
RocketNuts
  • 9,958
  • 11
  • 47
  • 88

1 Answers1

13

RocketNuts, you can simply execute:

brew install homebrew/php/php55-gmp

That's all what I did.

timhtheos
  • 473
  • 5
  • 6
  • [Commonly](https://github.com/Homebrew/homebrew-php/issues/1946), if you have upgraded either Xcode or the Mac OS since you installed PHP, you will have to also run `xcode-select --install` from the command line. – EricRobertBrewer Nov 27 '17 at 19:56
  • 4
    For PHP7, use `brew install homebrew/php/php70-gmp` – kakoma Dec 20 '17 at 10:20
  • 2
    it necessary to reinstall php@7.1 with homebrew/core since homebrew/php is deprecated – iMezied Jul 31 '18 at 19:57
  • @iMezied how do you do that with gmp? brew search gmp shows no php options, similiarly brew search php shows no gmp options. – cloudsurfin Dec 17 '20 at 21:17