Recently did a brew install and it started updating all the things. With a new version of PHP out, it decided to break my link with an ominous error:
dyld: Library not loaded: /usr/local/opt/openldap/lib/libldap-2.5.0.dylib Referenced from: /usr/local/bin/php Reason: image not found
Fortunately the fix was pretty easy:
brew unlink php brew link --force --overwrite email@example.com
Where you can replace 7.4 with the version of PHP you’d like to use.
Voila, all good:
php --version PHP 7.4.26 (cli) (built: Nov 28 2021 17:11:17) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.26, Copyright (c), by Zend Technologies
Hopefully this helps someone, at least it’ll help myself the next time it happens 🙂