I was trying to install Valet and for a mistake I uninstall php from brew, now I reinstall php, if I go to a phpinfo() file on apache I can see
PHP Version 7.1.23
but if I do php -v
on console, or something other php command i get:
dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib Referenced from: /usr/local/bin/php Reason: image not found Abort trap: 6
Im on Mac Os Sierra
There's a couple of ways you could try to resolve this:
$ brew link readline
or perhaps:
$ brew link readline --force
If that doesn't work try:
$ cd /usr/local/opt/readline/lib/
$ ln -s libreadline.dylib libreadline.7.dylib
↳ Github Discussion : libreadline (image not found)
For me, I had php 5.4 installed, but an upgrade to php 7.3 worked for me.
brew install [email protected]
Then you'll likely need to add the new php version in your path. This basically means that when you load up your shell it knows where find the path to the files that you are using. For me, since I'm using zshrc that command is:
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
For you, if you have all your path and aliases in bash profile then the command would be this instead:
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile
Then, all you need to do is either source your zshrc or your bash_profile file, OR close that tab and open a new one. The source command basically says "hey, make sure you have an updated list of my aliases and path info". This naturally happens when you open a new shell, but you can force that with a command like:
source ~/.bash_profile
And then it worked for me. Good luck.
Try this:
$ cd /usr/local/opt/readline/lib/
$ ln -s libreadline.dylib libreadline.7.dylib
Then :
brew unlink readline && brew link --force readline
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With