Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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
up vote 8 down vote accepted explains this behavior.

To fix this, simply run the following:

ln -fs /usr/lib/x86_64-linux-gnu/ /usr/lib/

Vola, compiling away.

share|improve this answer
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
confirmed fix for Ubuntu 13.10 – ehime Oct 21 '13 at 20:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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