开发者

Fatal error: Call to undefined function ldap_connect() in ubuntu

I'm trying to connect to my LDAP serv开发者_如何学Goer via PHP, but I get the following error:

Fatal error: Call to undefined function ldap_connect()

Any help would be very appreciated.

Thanks in advance, roshan


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

Install LDAP Extension

There 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 package can usually be installed like:

sudo apt-get install php5-ldap

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

Enable LDAP Extension

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

sudo php5enmod ldap

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

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

sudo service apache2 restart

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


sudo apt-get install php5-ldap

And don't afraid to google.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜