dougao2830 2019-04-24 21:14
浏览 652
已采纳

在Mac上安装PHP时如何克服“dyld:Library not loaded:”错误?

I'm trying to install the latest version of PHP on my Mac. I tried this

brew install php72 --force

and then wanted to check the version, but got this error

localhost:regagents davea$ php --version
dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib
  Referenced from: /usr/local/Cellar/php72/7.2.1_12/bin/php
  Reason: image not found
Abort trap: 6

so I figured I could re-install readline, so I think I did ...

 localhost:regagents davea$ brew reinstall readline
==> Reinstalling readline
==> Downloading https://homebrew.bintray.com/bottles/readline-8.0.0.high_sierra.bottle.tar.gz
Already downloaded: /Users/davea/Library/Caches/Homebrew/downloads/c0566e677ba9f92c270590e2d8132f95668817a7817d2ee47711ff3c2ff045d6--readline-8.0.0.high_sierra.bottle.tar.gz
==> Pouring readline-8.0.0.high_sierra.bottle.tar.gz
==> Caveats
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.

For compilers to find readline you may need to set:
export LDFLAGS="-L/usr/local/opt/readline/lib"
export CPPFLAGS="-I/usr/local/opt/readline/include"

For pkg-config to find readline you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig"

==> Summary

  • 写回答

1条回答 默认 最新

  • dongluyi5123 2019-04-24 21:31
    关注

    Your older version of php is linked against readline 7. You have readline 8. Update php: the latest version of the php72 package in homebrew is 7.2.17_1.

    brew update
    brew upgrade php72
    

    php 7.3.4 is available from the php package. To install the latest version of php:

    brew install php
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?