Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable GMP in PHP on OS X?

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).

like image 666
RocketNuts Avatar asked Nov 03 '15 00:11

RocketNuts


People also ask

How do I enable GMP?

GMP module is by default added to PHP. You can activate the same by removing the (;) ;extension=gmp added at the start of the extension in php. ini.

What is GMP PHP extension?

Name : php-gmp Arch : x86_64 Version : 7.2. 11 Summary : A module for PHP applications for using the GNU MP library Description : These functions allow you to work with arbitrary-length integers using the GNU MP library.

Does Mac OS have PHP?

PHP is bundled with macOS since macOS X (10.0. 0) prior to macOS Monterey (12.0. 0). Compiling is similar to the Unix installation guide.


1 Answers

RocketNuts, you can simply execute:

brew install homebrew/php/php55-gmp

That's all what I did.

like image 79
timhtheos Avatar answered Oct 10 '22 12:10

timhtheos