[ACCEPTED]-Fatal error: Call to undefined function ldap_connect() in ubuntu-ldap

Accepted answer
Score: 42

Make sure the LDAP extension is installed and enabled. This 15 answer assumes you have PHP5, however, things 14 should work similarly for PHP7 as well.

Install LDAP Extension

There 13 should be a package named like php5-ldap:

aptitude show php5-ldap
Paquet : php5-ldap
Description : LDAP module for php5                                                                                                                                                                                                           
 This package provides a module for LDAP functions in PHP scripts.

Thus, the 12 package can usually be installed like:

sudo apt-get install php5-ldap

If 11 you do not use apt-get, use the equivalent command 10 for the package manager you use.

Enable LDAP Extension

To enable 9 the package after installation, you can 8 use this command:

sudo php5enmod ldap

If you get any error message 7 from the above command, it means something 6 went wrong.

Note: After enabling the package, you 5 usually have to restart / reload services 4 so that the newly enabled module is recognized. For 3 apache, you can do this by:

sudo service apache2 restart

If you do not 2 use apache, please use the equivalent command 1 for your server.

Score: 4
sudo apt-get install php5-ldap

And don't afraid to google.


More Related questions