phpdyld

php dyld: Library not loaded for libldap


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:

How can I fix this?


Solution

  • 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.