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.

  • 1
    I'm sure I'm missing something here, but why are you compiling LDAP support in Ubuntu? There is a package in the repos for it: sudo apt-get install php5-ldap – Soviero Nov 1 '12 at 16:29
  • php5-ldap installs php5-common, which for some reason installs PHP 5.4.6~ubuntu CLI. I'm compiling PHP 5.4.8 from source. – Andrew Ellis Nov 1 '12 at 22:05

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.

  • Also worth noting in case you're wondering... --with-libdir=lib64 causes other parts of the configuration to fail. This is why you have to symlink lib64 libraries individually. – Andrew Ellis Nov 1 '12 at 16:25
  • 1
    confirmed fix for Ubuntu 13.10 – ehime Oct 21 '13 at 20:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.