php 致命错误:调用未定义的函数:ldap_connect()
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16864306/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Fatal error: Call to undefined function: ldap_connect()
提问by Josh M
I get this error when using WAMP:
使用 WAMP 时出现此错误:
Fatal error: Call to undefined function:
ldap_connect()
致命错误:调用未定义的函数:
ldap_connect()
I have already edited the php.inifolder and enabled php_ldap.dll.
我已经编辑了php.ini文件夹并启用了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.
出于某种原因,phpinfo()当我打开它们时,只有一些扩展会出现。我已经重新启动了 Apache 并重新启动了我的计算机。
回答by sushant-hiray
If you are a Windows user, this is a common error when you use XAMPPsince LDAPis not enabled by default.
如果您是 Windows 用户,这是您使用时的常见错误,XAMPP因为LDAP默认情况下未启用。
You can follow this steps to make sure LDAPworks in your XAMPP:
您可以按照以下步骤确保LDAP在您的XAMPP:
[Your Drive]:\xampp\php\php.ini: In this file uncomment the following line:extension=php_ldap.dllMove the file:
libsasl.dll, from[Your Drive]:\xampp\phpto[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!
[Your Drive]:\xampp\php\php.ini:在此文件中取消注释以下行:extension=php_ldap.dll移动文件:
libsasl.dll, from[Your Drive]:\xampp\phpto[Your Drive]:\xampp\apache\bin(注意: 移动文件只需要在 XAMPP 之前的版本:5.6.28)- 重新启动阿帕奇。
- 您现在可以使用 LDAP 模块的功能了!
If you use Linux:
如果您使用 Linux:
For php5:
对于 php5:
sudo apt-get install php5-ldap
For php7:
对于 php7:
sudo apt-get install php7.0-ldap
running the above command should do the trick.
运行上面的命令应该可以解决问题。
回答by HimalayanCoder
Add path of your PHP to Windows System Path. The path should contain php.exe.
将 PHP 的路径添加到 Windows 系统路径。路径应包含php.exe.
After adding the path open a new command prompt and make sure php.exeis in path by typing
添加路径后打开一个新的命令提示符并php.exe通过键入确保在路径中
C:\>php --help
Once you see proper help message from above, enable the php_ldap.dllextension in php.ini
从上面看到正确的帮助消息后,请启用php_ldap.dll扩展php.ini
Also copy php_ldap.dllfrom php/extdirectory to apache/binfolder
同时php_ldap.dll从php/ext目录复制到apache/bin文件夹
Restart wamp and phpinfo()will now show ldap enabled.
重新启动 wamp,phpinfo()现在将显示 ldap 已启用。
回答by Sakawa Bob
[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 Restart Apache. You can now use functions of the LDAP Module!
[您的驱动器]:\xampp\php\php.ini:在此文件中取消注释以下行:
扩展名=php_ldap.dll
将文件:libsasl.dll,从 [Your Drive]:\xampp\php 移动到 [Your Drive]:\xampp\apache\bin 重新启动 Apache。您现在可以使用 LDAP 模块的功能了!

