[英]Installing GMP on macOS High SIerra via Homebrew
我一直試圖在我的機器上運行它: https : //github.com/Minishlink/web-push-php-example
創建項目並更改為目錄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 requested PHP extension gmp is missing from your system.
所以我通過Homebrew安裝了gmp。
之后搜索gmp返回此:
==> Searching local taps...
gmp ✔
==> Searching taps on GitHub...
==> Searching blacklisted, migrated and deleted formulae...
但是,如果我檢查列表,它是由php -m
返回的,則不存在。
我還嘗試通過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'
當然,在我的項目目錄中嘗試composer install
時,我仍然會遇到相同的錯誤。
請幫幫我! 我不知道該怎么辦...
這些步驟幫助我解決了這個問題。 安裝PHP版本
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"
再試一次
composer install
嘗試brew upgrade php@7.1
。 完成后,重新啟動Laravel中的內置PHP
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.