无法获取LDAP函数以在PHP中加载 [英] Can't get LDAP functions to load in PHP

查看:123
本文介绍了无法获取LDAP函数以在PHP中加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当尝试使用 ldap_connect() 时,出现此错误:

When attempting to use ldap_connect(), I get this error:

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

Fatal error: Call to undefined function ldap_connect()

我已经在启用LDAP apache模块的情况下重新编译了php,并且也编辑了php.ini文件,并且没有注释:

I've recompiled php with the LDAP apache module enabled, and I've edited my php.ini file, too and uncommented:

extension=php_ldap.dll

我使用的是Red Hat Linux,php 5.3.10,apache 2.2.有什么想法吗?

I'm on Red Hat Linux, php 5.3.10, apache 2.2. Any ideas?

已加载的Apache模块:(包含* util_ldap *)

核心mod_authn_file模块mod_authn_default mod_authz_host mod_authz_groupfile mod_authz_user mod_authz_default mod_auth_basic mod_include负责mod_filter util_ldap mod_log_config mod_logio mod_env指定mod_expires mod_headers中mod_setenvif mod_version mod_proxy的mod_proxy_connect mod_proxy_ftp模块mod_proxy_http mod_proxy_scgi的mod_proxy_ajp mod_proxy_balancer的mod_ssl的prefork的http_core mod_mime mod_status的mod_autoindex mod_asis mod_info mod_suexec mod_cgi一样mod_negotiation模块mod_dir mod_actions mod_userdir mod_alias中的mod_rewrite mod_so mod_auth_passthrough mod_bwlimited mod_fpcgid mod_php5 mod_security的

core mod_authn_file mod_authn_default mod_authz_host mod_authz_groupfile mod_authz_user mod_authz_default mod_auth_basic mod_include mod_filter util_ldap mod_log_config mod_logio mod_env mod_expires mod_headers mod_setenvif mod_version mod_proxy mod_proxy_connect mod_proxy_ftp mod_proxy_http mod_proxy_scgi mod_proxy_ajp mod_proxy_balancer mod_ssl prefork http_core mod_mime mod_status mod_autoindex mod_asis mod_info mod_suexec mod_cgi mod_negotiation mod_dir mod_actions mod_userdir mod_alias mod_rewrite mod_so mod_auth_passthrough mod_bwlimited mod_fpcgid mod_php5 mod_security

Apache协议:(包含: ldap )

Apache Protocols: (contains: ldap)

dict,文件,ftp,ftps,gopher,http,https,imap,imaps,ldap,ldaps,pop3,pop3s,rtsp,smtp,smtps,telnet,tftp

dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, pop3, pop3s, rtsp, smtp, smtps, telnet, tftp

推荐答案

您编写:

尝试使用ldap_connect()时,出现此错误:

When attempting to use ldap_connect(), I get this error:

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

Fatal error: Call to undefined function ldap_connect()

您会收到此错误,因为函数 ldap_connect ­ Docs 没有定义.您无法在PHP中调用未定义的函数,这就是为什么您看到致命错误的原因.

You get this error because the function ldap_connect­Docs is not defined. You can not call an undefined function in PHP, that's why you see the fatal error.

要定义该功能,您需要加载称为LDAP的PHP模块/扩展名.它带有安装说明.您写道:

To get that function defined, you need to load a PHP module/extension called LDAP. It comes with installation intructions. You wrote:

我已经在LDAP apache模块启用的情况下重新编译了php.

I've recompiled php with the LDAP apache module enabled.

如果重新编译PHP,请确保启用LDAP,请参阅:

If you recompile PHP, ensure you enable LDAP, see:

在编译PHP来启用LDAP支持时,您将需要使用--with-ldap[=DIR]配置选项. DIR是LDAP基本安装目录.

You will need to use the --with-ldap[=DIR] configuration option when compiling PHP to enable LDAP support. DIR is the LDAP base install directory.

但是,通常只需通过软件包管理器安装所需的内容即可,例如尝试:

However, normally it's enough to just install what you need via the package manager, e.g. try:

# yum install php-ldap

如果这还不够,而您实际上需要编辑PHP配置(并非总是需要),请执行以下操作:

If it's not enough and you actually need to edit your PHP configuration (not always necessary), do it:

$ vi /etc/php.ini

add extension=ldap.so

# service httpd restart

我希望这会有所帮助.请注意.dll仅是Windows.

I hope this is helpful. Take care that .dll is windows only.

这篇关于无法获取LDAP函数以在PHP中加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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