简体   繁体   English

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

[英]How to overcome the “dyld: Library not loaded:” error when installing PHP on Mac?

I'm trying to install the latest version of PHP on my Mac. 我正在尝试在Mac上安装最新版本的PHP。 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 ... 所以我想我可以重新安装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

but then running "php -version" gives me the same error. 但后来运行“php -version”给了我同样的错误。 What gives? 是什么赋予了? How do I install and run php on my Mac? 如何在Mac上安装和运行php?

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. 你的旧版本的php与readline 7相关联。你有readline 8.更新php:homebrew中最新版本的php72软件包是7.2.17_1。

brew update
brew upgrade php72

php 7.3.4 is available from the php package. php 7.3.4可以从php包中获得。 To install the latest version of php: 要安装最新版本的php:

brew install php

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

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