简体   繁体   English

通过Homebrew在macOS High SIerra上安装GMP

[英]Installing GMP on macOS High SIerra via Homebrew

I have been trying to get this running on my machine: https://github.com/Minishlink/web-push-php-example 我一直试图在我的机器上运行它: https : //github.com/Minishlink/web-push-php-example

After creating the project and changing into the directory composer install returned this: 创建项目并更改为目录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.

The problems it then lists all look close to this: 然后列出的问题看起来都与此相似:

the requested PHP extension gmp is missing from your system.

So I installed gmp via Homebrew. 所以我通过Homebrew安装了gmp。

Searching for gmp afterwards returned this: 之后搜索gmp返回此:

==> Searching local taps...
gmp ✔
==> Searching taps on GitHub...
==> Searching blacklisted, migrated and deleted formulae...

But if I check the list, that is returned by php -m it is not there. 但是,如果我检查列表,它是由php -m返回的,则不存在。

I also tried adding the extension via extension=gmp.so to the php.ini which resulted in new errors. 我还尝试通过extension=gmp.so将扩展extension=gmp.so到php.ini中,这导致了新错误。

PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20160303/php_gmp.so'

And of course I still get the same errors when trying composer install in my project directory. 当然,在我的项目目录中尝试composer install时,我仍然会遇到相同的错误。

Please help me out! 请帮帮我! I don't know what to do... 我不知道该怎么办...

These steps helped me resolve this issue. 这些步骤帮助我解决了这个问题。 Install php version 安装PHP版本

brew install php@7.1

add php path to ~/.bash_profile or ~/.zshrc : 将php路径添加到〜/ .bash_profile或〜/ .zshrc中:

export PATH="/usr/local/opt/php@7.1/bin:$PATH"

then source file, start php and check gmp has been loaded 然后源文件,启动php并检查是否已加载gmp

brew services start php@7.1
source ~/.zshrc
php -info | grep "GMP"

try again 再试一次

composer install

Try brew upgrade php@7.1 . 尝试brew upgrade php@7.1 Once complete, restart the built-in PHP in Laravel 完成后,重新启动Laravel中的内置PHP

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM