致命错误:在ubuntu中调用未定义的函数ldap_connect() [英] Fatal error: Call to undefined function ldap_connect() in ubuntu

查看:64
本文介绍了致命错误:在ubuntu中调用未定义的函数ldap_connect()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过PHP连接到我的LDAP服务器,但是出现以下错误:

I'm trying to connect to my LDAP server via PHP, but I get the following error:

致命错误:调用未定义的函数ldap_connect()

Fatal error: Call to undefined function ldap_connect()

任何帮助将不胜感激.

预先感谢, 萝珊

推荐答案

确保 LDAP扩展 已安装并启用.该答案假设您拥有PHP5,但是,PHP7的工作原理也应与此类似.

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

安装LDAP扩展

应该有一个名为 php5-ldap 的软件包:

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

如果不使用apt-get,请对所使用的程序包管理器使用等效的命令.

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

启用LDAP扩展

要在安装后启用软件包,可以使用以下命令:

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.

注意::启用软件包后,通常必须重新启动/重新加载服务,以便识别新启用的模块.对于apache,您可以通过以下方式实现:

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

如果您不使用apache,请对您的服务器使用等效的命令.

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

这篇关于致命错误:在ubuntu中调用未定义的函数ldap_connect()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆