I'm on Linux Mint - i can't compile php with LDAP support
Configure says :
checking for LDAP Cyrus SASL support... yes
configure: error: Cannot find ldap libraries in /usr/lib.
But every -dev libs seems to be installed :
dpkg -l *ldap* | grep ii
ii ldap-utils 2.4.28-1.1ubuntu4.1 OpenLDAP utilities
ii ldaptor-utils 0.0.43+debian1-6ubuntu1 command-line LDAP utilities
ii libaprutil1-ldap 1.3.12+dfsg-3 Apache Portable Runtime Utility Library - LDAP Driver
ii libkldap4 4:4.8.5-0ubuntu0.1 library for accessing LDAP
ii libldap-2.4-2 2.4.28-1.1ubuntu4.1 OpenLDAP libraries
ii libldap2-dev 2.4.28-1.1ubuntu4.1 OpenLDAP development libraries
ii libnet-ldap-perl 1:0.4300-2ubuntu1 client interface to LDAP servers
ii libsasl2-modules-ldap 2.1.25.dfsg1-3ubuntu0.1 Cyrus SASL - pluggable authentication modules (LDAP)
ii php5-ldap 5.3.10-1ubuntu3.4 LDAP module for php5
ii python-ldaptor 0.0.43+debian1-6ubuntu1 pure-Python library for LDAP operations
This is not the first time it breaks, each time with some new strange location for the libs or some new special packages, or whatever... Has any of you found out for this time ? This is php 5.4.7.
Thanks,
You can try and check it with extension_loaded() like this: $builtWithLdap = extension_loaded('ldap'); or alternativly as a crowbar approach, just check if one of the functions exists: $builtWithLdap = function_exists('ldap_add');
LDAP support in PHP is not enabled by default. You will need to use the --with-ldap[=DIR] configuration option when compiling PHP to enable LDAP support. DIR is the LDAP base install directory. To enable SASL support, be sure --with-ldap-sasl[=DIR] is used, and that sasl.
Install LDAP in Linux 2.1 If your PHP is compiled and installed, you need to add the"--with-ldap" to recompile the installation. 2.2 If your PHP is installed through the Linux package manager, you can install the php_ldap through the package manager. Taking Debian as an example, implement apt-get install php5-ldap.
Believe it or not, configure fails to find ldap.so which is under /usr/lib/i386-linux-gnu
So i made those links : (liblber is a friend of libldap)
cd /usr/lib
ln -s i386-linux-gnu/libldap.so
ln -s i386-linux-gnu/liblber.so
And configure succeed. The bad thing is 'make' don't work, because :
/usr/bin/ld: ext/ldap/.libs/ldap.o: undefined reference to symbol 'ber_strdup@@OPENLDAP_2.4_2'
/usr/bin/ld: note: 'ber_strdup@@OPENLDAP_2.4_2' is defined in DSO /usr/lib/i386-linux-gnu/liblber-2.4.so.2 so try adding it to the linker command line
/usr/lib/i386-linux-gnu/liblber-2.4.so.2: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Erreur 1
It seems to be a bug in PHP - i've seen some others like that fixed by PHP devs in the past.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With