我正在尝试为PHP安装并启用GMP扩展。
Mac OS High Sierra 10.13.5
PHP Version: 7.1.16
Composer version: 1.6.5
Homebrew version: 1.6.9
运行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.
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
在Composer安装上仍然出现相同的错误。有人可以帮我吗?
答案 0 :(得分:0)
重新开始。安装PHP 7
brew install php@7.1
将php路径添加到~/.bash_profile
或~/.zshrc
:
export PATH="/usr/local/opt/php@7.1/bin:$PATH"
然后源文件,启动php并检查gmp是否已加载
brew services start php@7.1
source ~/.zshrc
php -info | grep "GMP"
再试一次
答案 1 :(得分:0)
我能够按照以下指南进行修复-https://getgrav.org/blog/macos-sierra-apache-multiple-php-versions
它删除了已经安装的Apache和PHP。