Call to undefined function ldap_connect()

Asked by Bill Gosse on 2012-08-02

I'm trying to implement the sample code in the The LDAP (a.k.a active directory) plugin. Everything seem to be working fine up until the point when the ldap_connect() call in the AUTH_ldap.class.php is made. Then I get the following:
The message of the error is as follow:

Call to undefined function ldap_connect()

The error occurred in file C:\Dev\xampp\htdocs\phpdev\plugins\PluggableAuth\includes\AUTH_ldap.class.php at line 26

20 $server = parse_url($sourceConfig['url']);
21
22 if (empty($server['host'])) {
23 return false; // oops
24 }
25
26 $connect = ldap_connect($server['host'], empty($server['port']) ? 389 : $server['port']);
27 ldap_set_option($connect, LDAP_OPT_PROTOCOL_VERSION, 3);
28 ldap_set_option($connect, LDAP_OPT_REFERRALS, 0);
29
30 //$connect=ldap_connect($server['host']);
31 $this->log('Connected');
32 if (!$connect) throw new PHPDS_exception('Unable to connect to the LDAP server');

Is there some other additional softwar that I need to install in order to get this example to work.

Question information

Language:
English Edit question
Status:
Solved
For:
PHPDevShell Edit question
Assignee:
No assignee Edit question
Solved by:
Bill Gosse
Solved:
2012-08-03
Last query:
2012-08-03
Last reply:
Bill Gosse (bill-gosse) said : #1

I figure this out. I needed to enable the ldap extension and move some other dll into the path. Now the call is working. Sorry for the newbie question. PHP not my strong suite I've been a Java EE guy for the last 12 years.

Bill Gosse (bill-gosse) said : #2

This link was useful for getting ldap setup correctly in xampp: http://wptidbits.com/webs/enable-php-ldap-module-in-xampp/

Greg (gregfr) said : #3

Thanks for the link. We need to write a proper documentation for the Auth plugin. It'll probably be done after we implement OpenID.