Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fatal error: Call to undefined function: ldap_connect()

Tags:

php

wamp

I get this error when using WAMP:

Fatal error: Call to undefined function: ldap_connect()

I have already edited the php.ini folder and enabled php_ldap.dll.

For some reason only some of the extensions show up in phpinfo() when I turn them on. I have restarted Apache and restarted my computer.

like image 441
Josh M Avatar asked May 31 '13 19:05

Josh M


2 Answers

If you are a Windows user, this is a common error when you use XAMPP since LDAP is not enabled by default.

You can follow this steps to make sure LDAP works in your XAMPP:

  • [Your Drive]:\xampp\php\php.ini: In this file uncomment the following line:

     extension=php_ldap.dll
    
  • Move the file: libsasl.dll, from [Your Drive]:\xampp\php to [Your Drive]:\xampp\apache\bin (Note: moving the file is needed only for XAMPP prior to version: 5.6.28)

  • Restart Apache.

  • You can now use functions of the LDAP Module!

If you use Linux:

For php5:

sudo apt-get install php5-ldap

For php7:

sudo apt-get install php7.0-ldap

If you are using the latest version of PHP you can do

sudo apt-get install php-ldap

running the above command should do the trick.

if for any reason it doesn't work check your php.ini configuration to enable ldap, remove the semicolon before extension=ldap to uncomment, save and restart Apache

like image 79
sushant-hiray Avatar answered Nov 16 '22 00:11

sushant-hiray


Add path of your PHP to Windows System Path. The path should contain php.exe.

After adding the path open a new command prompt and make sure php.exe is in path by typing

C:\>php --help

Once you see proper help message from above, enable the php_ldap.dll extension in php.ini

Also copy php_ldap.dll from php/ext directory to apache/bin folder

Restart wamp and phpinfo() will now show ldap enabled.

like image 34
HimalayanCoder Avatar answered Nov 16 '22 00:11

HimalayanCoder