How to install PHP GMP on macOS High Sierra?
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
.
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:
composer.json
"ext-gmp": "*"
brew install homebrew/php/php70-gmp
brew install gmp
brew install homebrew/homebrew-core/php70-gmp
php.ini
extension=php_gmp.dll
I'm still getting the same error on composer install. Can anyone please help me with this?
brew install php71-gmp
It says
Error: No available formula with the name "php71-gmp"
– akshaykumar6
Jun 29 at 8:41
Error: No available formula with the name "php71-gmp"
2 Answers
2
Start Again. Install PHP 7
brew install php@7.1
brew install php@7.1
add php path to ~/.bash_profile
or ~/.zshrc
:
~/.bash_profile
~/.zshrc
export PATH="/usr/local/opt/php@7.1/bin:$PATH"
then source file, start php and check gmp has been loaded
brew services start php@7.1
source ~/.zshrc
php -info | grep "GMP"
Try Again
Do I have to install php again? I have followed this guide - websitebeaver.com/… Everything else is working fine.
– akshaykumar6
Jun 29 at 8:45
ok. just try to restart php.
– Umair Iftikhar
Jun 29 at 8:46
try this and then do above step again
sudo apachectl restart
– Umair Iftikhar
Jun 29 at 8:49
sudo apachectl restart
I have not installed PHP via brew. High Sierra already comes with PHP 7.1 installed. I'm using that.
– akshaykumar6
Jun 29 at 8:54
In my mac I install composer via help of this link try this method if you just want to install composer.
– Umair Iftikhar
Jun 29 at 8:57
I was able to fix this by following this guide - https://getgrav.org/blog/macos-sierra-apache-multiple-php-versions
It removes already installed apache and PHP.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Did you try
brew install php71-gmp
?– Prashant Barve
Jun 29 at 8:36