How do I enable GMP on Mac OS X / PHP 7?

2019-08-04 17:46发布

问题:

I'm using PHP 7 and Mac High Sierra. I'm trying to install and enable GMP. I installed via

brew install homebrew/php/php70-gmp

but when I try and enable the module through the php.ini (/usr/local/etc/php/7.0/php.ini) file, I'm failing . I tried uncommenting the line

extension=php_gmp.dll

but I get this error when running composer

Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php70/7.0.27_19/lib/php/extensions/no-debug-non-zts-20151012/php_gmp.dll' - dlopen(/usr/local/Cellar/php70/7.0.27_19/lib/php/extensions/no-debug-non-zts-20151012/php_gmp.dll, 9): image not found in Unknown on line 0

How do I enable GMP in my php.ini file?

回答1:

Using some .dll file is not usual for a Mac system. Can you have a look at the folder /usr/local/Cellar/php70/7.0.27_19/lib/php/extensions/no-debug-non-zts-20151012/ to see if there is any other GMP related file? Probably, you should add the extension through

extension=gmp.so