Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install PHP GMP on macOS High Sierra?

I am trying to install and enable GMP extension for PHP.

Mac OS High Sierra 10.13.5
PHP Version: 7.1.16
Composer version: 1.6.5
Homebrew version: 1.6.9

I am getting this error when I run composer install.

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested PHP extension ext-gmp * is missing from your system. Install or enable PHP's gmp extension.

The composer.json has dependency on "ext-gmp": "*" . I have tried following things:

  1. brew install homebrew/php/php70-gmp
  2. brew install gmp
  3. brew install homebrew/homebrew-core/php70-gmp
  4. Changed in php.ini to enable extension=php_gmp.dll

I'm still getting the same error on composer install. Can anyone please help me with this?

like image 738
akshaykumar6 Avatar asked Jun 29 '18 08:06

akshaykumar6


People also ask

How do I install or enable PHP's GMP extension?

GMP installation in PHP 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. After that restart apache and to confirm if the changes are reflecting.

Can you download PHP on Mac?

PHP comes preinstalled on most macOS systems, so you usually don't need any manual installation.


1 Answers

Start Again. Install PHP 7

brew install [email protected]

add php path to ~/.bash_profile or ~/.zshrc :

export PATH="/usr/local/opt/[email protected]/bin:$PATH"

then source file, start php and check gmp has been loaded

brew services start [email protected]
source ~/.zshrc
php -info | grep "GMP"

Try Again

like image 73
Umair Iftikhar Avatar answered Sep 30 '22 04:09

Umair Iftikhar