I installed ruby on my Mac OSX High Sierra
and am running into issues now with my php installation for some reason. I'm on php 7.1
.
Following this (also here ) Github suggestion, I tried
brew update && brew reinstall php71
While installing, it broke at
==> Pouring php@7.1-7.1.23.high_sierra.bottle.tar.gz
==> /usr/local/Cellar/php@7.1/7.1.23/bin/pear config-set php_ini /usr/local/etc/php/7.1/php.ini system
With error:
dyld: Library not loaded: /usr/local/opt/openldap/lib/libldap-2.4.2.dylib
Referenced from: /usr/local/Cellar/php@7.1/7.1.23/bin/php
Reason: image not found
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall php@7.1`
Typing in php
into terminal throws the same error.
Other things I've tried:
brew unlink libldap && brew link libldap
- but libldap
is not supported by Homebrewlibldap
and says to install via brew install openldap
(I guess libldap
is referred to as openldap
to Homebrew) - this installed fine but didn't resolve the issueHow can I fix this?
According to this issue , you need to install openldap
and libiconv
.
brew install openldap libiconv
I tried it and it worked for my system. I was originally missing the PHP intl
extension.
Although I'm not sure why installing Ruby caused the issue, I solved the issue ultimately with:
libldap
is referred to as openldap
to Homebrew. brew install openldap
then ran php reinstall php71
. This linked the libraries properlylibiconv
, fortunately this is easily installed with brew install libiconv
. Rerunning php install php71
solved the problem它对我有用:
brew reinstall openldap
if you have two PHP running via brew as well a XAMPP, there could be issue in environment path in .bash_profile.
which php
Try above command to see current php path. If it not accurate, set appropriate path and comment other.
export PATH=/Applications/XAMPP/xamppfiles/bin:$PATH
#export PATH=”/usr/local/opt/php@5.6/bin:/usr/local/opt/php@5.6/sbin:$PATH
After trying all above solutions. Finally uninstalling and reinstalling worked for me.
brew uninstall php
brew install php
I specifically had to uninstall the offending version. You can grab this broken version from the line that looked like this:
Referenced from: /usr/local/Cellar/php@7.1/7.1.23/bin/php
In OP's case, it was php@7.1
. In my case it was php@7.3
. After I ran the following based on my situation, everything worked
brew uninstall php@7.3
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.