Ubuntu – Compiling PHP with LDAP support on Ubuntu 12.10

ldapPHPUbuntu

I am trying to compile PHP on Ubuntu 12.10 with LDAP support. I have run:

apt-get install libldap2-dev

That installs the header files to /usr/include.

However, when attempting to compile it is unable to locate the header files. I have tried to with --with-ldap=/usr/include as well and it still fails with:

configure: error: Cannot find ldap.h

I also tried symlinking with the following and I still get the same error:

ln -s /usr/lib/ldap* /usr/lib/

Thanks in advance for your help.

Best Answer

https://bugs.php.net/bug.php?id=49876 explains this behavior.

To fix this, simply run the following:

ln -fs /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/

Vola, compiling away.