php dyld: Library not loaded for libldap

南楼画角 提交于 2020-05-26 01:15:09

问题


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:

  • I thought perhaps it wasn't linked, so I also tried: brew unlink libldap && brew link libldap - but libldap is not supported by Homebrew
  • Then here, while unrelated to postgres, it does discuss the issue of libldap 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 issue

How can I fix this?


回答1:


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.




回答2:


Although I'm not sure why installing Ruby caused the issue, I solved the issue ultimately with:

  • According to this discussion, libldap is referred to as openldap to Homebrew. brew install openldap then ran php reinstall php71. This linked the libraries properly
  • The next issue was with libiconv, fortunately this is easily installed with brew install libiconv. Rerunning php install php71 solved the problem



回答3:


This issue is discussed and tracked at https://github.com/Homebrew/homebrew-core/issues/32916



来源:https://stackoverflow.com/questions/52795110/php-dyld-library-not-loaded-for-libldap

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!