Author Topic: "call to undefined function ldap_connect" and LDAP section not in phpinfo()  (Read 3276 times)

0 Members and 1 Guest are viewing this topic.

Offline dcparhamTopic starter

  • Irregular
  • Posts: 19
    • View Profile
forgive if this's alread posted, found nothing, and precious little on the internet regarding LDAP not in phpinfo().

am getting errormsg "call to undefined function ldap_connect".  i installed using "sudo apt-get install php5-ldap" and restarted Apache; ALSO there is no LDAP section in phpinfo().

what files need what settings/configurations to ensure LDAP is working?  i feel like i am spending way too much time on this step!

Offline flyhoney

  • Devotee
  • Posts: 845
  • Gender: Male
    • View Profile
    • blag
Are you on a Windows or *nix machine? 

You probably need to add the ldap extension to your php.ini file.
"The enemy's gate is down." - Ender
error_reporting(E_ALL);          // place these two lines at the top of 
ini_set('display_errors'1);    // the script you are debugging

Offline dcparhamTopic starter

  • Irregular
  • Posts: 19
    • View Profile
hello, fly - BTW "Ubuntu 8.04" [sorry did not specify before!]; i added to the correct php.ini file, in the area that looks like where the extension statement would go, by simply pasting:  "extension=mod_ldap.so" no quotes.  here is the section of the php.ini:

Code: [Select]
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
;
; If you wish to have an extension loaded automatically, use the following
; syntax:
;
;   extension=modulename.extension
;
; For example, on Windows:
;
;   extension=msql.dll
;
; ... or under UNIX:
;
;   extension=msql.so
extension=mod_ldap.so
;
; Note that it should be the name of the module only; no directory information
; needs to go here.  Specify the location of the extension with the
; extension_dir directive above.

THEN restarted apache, reran phpinfo(), and there is no LDAP section.  i even added to my code what your salutation footer shows:  "error_reporting(E_ALL);" and "ini_set('display_errors', 1);"  the phpinfo() when searching for LDAP via ctl-f and by eye - no LDAP section; mention of some ldap files but no ldap section. any ideas?

Offline flyhoney

  • Devotee
  • Posts: 845
  • Gender: Male
    • View Profile
    • blag
Is mod_ldap.so in your php extensions directory?
"The enemy's gate is down." - Ender
error_reporting(E_ALL);          // place these two lines at the top of 
ini_set('display_errors'1);    // the script you are debugging

Offline dcparhamTopic starter

  • Irregular
  • Posts: 19
    • View Profile
hi, Fly - one would think a simple "where is Ubuntu extensions directory?" would yield something, but so far i do not know where that directory is - is it different that the Extensions section of php.ini? ["Dynamic Extensions"].  see the code i posted: it is in the "Dynamic Extensions" section, yes - not sure URL's are allowed but if so, this url showed the syntax as i entered it: http://www.linuxquestions.org/questions/ubuntu-63/just-installed-ubuntu...-got-a-question-ldapphp-505689/.  i had added the extension=mod_ldap.so in the php.ini file.  thanks again for your help!

Offline dcparhamTopic starter

  • Irregular
  • Posts: 19
    • View Profile
ok - using your terminology exactly got me farther, and found in /usr/lib/php5/ldap.so - so i added in php.ini Dynamic Extensions section stmt: extension=ldap.so - and now i am [!viola!] at least seeing this in the phpinfo() [will copy and paste from the "ldap" section that now exists in phpinfo()]:
Code: [Select]
ldap
LDAP Support  enabled 
RCS Version  $Id: ldap.c,v 1.161.2.3.2.11 2007/07/17 09:09:42 jani Exp $ 
Total Links  0/unlimited 
API Version  3001 
Vendor Name  OpenLDAP 
Vendor Version  20409 
SASL Support  Enabled

now, the "undefined function ldap_connect" has disappeared, and in its place is [again]: "Search: Can't contact LDAP server" - round and round we go.  the line that causes the error is:

Code: [Select]
$results = ldap_search($ldapLink, $dn, "givenName=[person's first name here]");

[shifting wall-banging helmet due to poor scalp-padding]   ((([8])))