【问题标题】:How to overcome the "dyld: Library not loaded:" error when installing PHP on Mac?在 Mac 上安装 PHP 时如何克服“dyld: Library not loaded:”错误?
【发布时间】:2019-04-24 21:14:12
【问题描述】:

我正在尝试在我的 Mac 上安装最新版本的 PHP。我试过这个

brew install php72 --force

然后想检查版本,但得到这个错误

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

所以我想我可以重新安装 readline,所以我想我做到了......

 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
????  /usr/local/Cellar/readline/8.0.0: 48 files, 1.5MB

但随后运行“php -version”给了我同样的错误。是什么赋予了?如何在我的 Mac 上安装和运行 php?

【问题讨论】:

    标签: php macos dylib php-7.2


    【解决方案1】:

    您的旧版本 php 与 readline 7 相关联。您有 readline 8。更新 php:自制程序中 php72 软件包的最新版本是 7.2.17_1。

    brew update
    brew upgrade php72
    

    php 7.3.4 可从php 包中获得。安装最新版本的php:

    brew install php
    

    【讨论】:

      猜你喜欢
      • 2015-02-12
      • 1970-01-01
      • 1970-01-01
      • 2018-04-28
      • 2022-12-18
      • 2016-07-02
      • 1970-01-01
      • 2017-05-29
      • 1970-01-01
      相关资源
      最近更新 更多