garrettmassey's avatar

Installing PHP-Ldap extension on MacOS w/ Homebrew PHP8.2

We use Laravel Herd for our dev machines, because it makes it easy to standardize our systems across multiple devices, but unfortunately Herd doesn't come with the ldap extension installed, and we just started a project that requires the use of the extension for a package.

I know that Herd lets you link to your own .so extensions but I can't figure out how to install the ldap extension in the first place to link it to Herd.

I have tried following [this tutorial] but it only seems to work for PHP 7, and not PHP8, as when I try to install via brew using:

brew install [email protected]

I get the error that Error: No formulae or casks found for [email protected].

I have tried several variations on that command as well. PHP installed via homebrew seems to be able to enable ldap in the .ini file, but when i copied that section of the file to the herd php.ini file, I get the error:

Warning: PHP Startup: Unable to load dynamic library 'ldap' (tried: /lib/php/extensions/no-debug-non-zts-20220829/ldap (dlopen(/lib/php/extensions/no-debug-non-zts-20220829/ldap, 0x0009): tried: '/lib/php/extensions/no-debug-non-zts-20220829/ldap' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/lib/php/extensions/no-debug-non-zts-20220829/ldap' (no such file), '/lib/php/extensions/no-debug-non-zts-20220829/ldap' (no such file)), /lib/php/extensions/no-debug-non-zts-20220829/ldap.so (dlopen(/lib/php/extensions/no-debug-non-zts-20220829/ldap.so, 0x0009): tried: '/lib/php/extensions/no-debug-non-zts-20220829/ldap.so' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/lib/php/extensions/no-debug-non-zts-20220829/ldap.so' (no such file), '/lib/php/extensions/no-debug-non-zts-20220829/ldap.so' (no such file))) in Unknown on line 0

So herd can't find the extension.

I also tried to install it via pecl, but a ldap pecl package doesn't exist as far as I can tell.

Any ideas on how to install the ldap extension for php8.2 and then get the .so file path to add to Herd?

0 likes
2 replies
supanida's avatar

I have the same problem. Help is appreciated.

Tray2's avatar

If you have installed php with brew, it should already be installed.

This is what phpinfo() shows

ldap
LDAP Support	enabled
Total Links	0/unlimited
API Version	3001
Vendor Name	OpenLDAP
Vendor Version	20606
SASL Support	Enabled

Please or to participate in this conversation.