Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 with LDAP support using these lines:

./configure --prefix=/app/php --with-ldap=/usr     
sudo make     
sudo make install

Everything appears to install fine without issue, and PHP runs fine, but when I run a phpinfo, I don't see LDAP listed.

Also, I read somewhere that I could use an file in php's ext directory and reference it from php.ini ... ? How does on generate the file for php ... ?

Any ideas? I am on Mac OS X 10.5.8, php 5.2.17.


I've used these combinations of flags:


Of these, "--with-ldap=shared" produces an, which when placed into php's ext directory gives this error in Apache:

PHP Warning:  PHP Startup: Invalid library (maybe not a PHP library) ''  in Unknown on line 0

I've Googled this error, but haven't found much to resolve this issue. Any help is apprecaited!

Many thanks!


share|improve this question
up vote 1 down vote accepted

After you run configure you need to look in config.log to make sure php is correctly finding ldap.

There is nothing to put in php.ini. On Linux box with only --with-ldap and no php.ini phpinfo yields:


LDAP Support => enabled
RCS Version => $Id: ldap.c 293036 2010-01-03 09:23:27Z sebastian $
Total Links => 0/unlimited
API Version => 3001
Vendor Name => OpenLDAP
Vendor Version => 20343
share|improve this answer
Thanks @embobo. Was able to figure things out. Ended up installing PHP 5.3 from Entropy and making a few other config changes, and my step up looks similar to yours. – KM. Apr 12 '11 at 18:40

If you compile php with ldap it generates the file in the ext directory and next thing you have to do is to activate it through php.ini(path to php.ini file found in phpinfo() page)


uncomment this line to enable the ldap module for php

restart apache and start using it..

share|improve this answer
I thought as much, but I don't see anywhere, let alone in the ext directory. I see ldap.o and ldap.lo, and I tried those in the ext directory, w/ a corresponding php.ini entry to no avail. WDYT? – KM. Apr 8 '11 at 11: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.