shivammathur / homebrew-php

:beer: Homebrew tap for PHP 5.6 to 8.4. PHP 8.4 is built nightly.

Home Page:https://github.com/shivammathur/homebrew-php/packages

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failure to finish install: Library not loaded: /opt/homebrew/opt/openldap/lib/libldap-2.5.0.dylib

dspaude opened this issue · comments

Describe the bug
I have been following the steps of the following link to install Apache/PHP and the PHP 7.3 and 7.4 installs fail.
https://getgrav.org/blog/macos-monterey-apache-multiple-php-versions

At the end of the install I get this error:
dyld[58462]: Library not loaded: /opt/homebrew/opt/openldap/lib/libldap-2.5.0.dylib
Referenced from: /opt/homebrew/Cellar/php@7.4/7.4.26/bin/php
Reason: tried: '/opt/homebrew/opt/openldap/lib/libldap-2.5.0.dylib' (no such file), '/usr/local/lib/libldap-2.5.0.dylib' (no such file), '/usr/lib/libldap-2.5.0.dylib' (no such file), '/opt/homebrew/Cellar/openldap/2.6.0/lib/libldap-2.5.0.dylib' (no such file), '/usr/local/lib/libldap-2.5.0.dylib' (no such file), '/usr/lib/libldap-2.5.0.dylib' (no such file)
Warning: The post-install step did not complete successfully
You can try again using:
brew postinstall shivammathur/php/php@7.4

Trying postinstall also fails in the same way (libldap - no such file).

PHP versions
Attempted to install 7.4 and 7.3 and both failed with the same libldap failure.

To Reproduce
brew tap shivammathur/php
brew install shivammathur/php/php@7.4
brew unlink php && brew link --overwrite --force php@7.4

Expected behavior
I expected to be able to link the 7.4 version, but it cannot be linked and gives this error:

username ~ % brew unlink php && brew link --overwrite --force php@7.4
Error: No such keg: /opt/homebrew/Cellar/php

Screenshots/Logs

Additional context
MacBook Pro 14.2" M1 Pro
macOS Monterey 12.0.1
Latest Xcode was installed today (from scratch, not an upgrade)
Installed command line utilities today as mentioned in the guide (linked above)

Homebrew 3.3.5
Homebrew/homebrew-core (git revision e2eb0fb823f; last commit 2021-11-24)
Homebrew/homebrew-cask (git revision e42a605cc0; last commit 2021-11-25)

I performed this same process on a different system (same specs), except that in that case Xcode was already installed, so was updated to latest instead of a clean install. That system didn't have a problem. So, I've been through the steps above without a problem, but on my own personal system it is failing.

Are you willing to submit a PR?
No.

@dspaude

Openldap has been updated to 2.6.0 and all the PHP versions have been re-built with the new version.

Run brew update and then reinstall the PHP version.

For example for PHP 7.4

brew update
brew reinstall shivammathur/php/php@7.4
brew link --force --overwrite php@7.4

Excellent! Thank you so much! PHP 7.4 is working now.