I’m trying to connect to my LDAP server 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
2 Answers 2
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:
Thus, the package can usually be installed like:
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:
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:
If you do not use apache, please use the equivalent command for your server.
I get this error when using WAMP.
Fatal error: Call to undefined function: ldap_connect()
I have already edited the php.ini folder and enabled 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.
3 Answers 3
If you are a Windows user, this is a common error when you use XAMPP since LDAP is not enabled by default.
You can follow this steps to make sure LDAP works in your XAMPP :
[Your Drive]:xamppphpphp.ini : In this file uncomment the following line:
Move the file: libsasl.dll , from [Your Drive]:xamppphp to [Your Drive]:xamppapachein (Note: moving the file is needed only for XAMPP prior to version: 5.6.28 )
If you use Linux:
running the above command should do the trick.
Всем доброго времени суток..
Столкнулся с такой проблемой: развернул друпал 6.11 на данвере, настраиваю LDAP Authentication. При попытке зайти на портал под одним из пользователей из моего Active Directory вылезает вот такое : Fatal error: Call to undefined function ldap_connect() in Z:homeintranet.lcwwwsitesallmodulesldap_integrationldap_integrationLDAPInterface.php on line 132
вот кусок из указанного файла
function initConnection() <
if (!$con = ldap_connect($this->server, $this->port)) < (это та самая 132ая строчка)
watchdog(‘user’, ‘LDAP Connect failure to ‘. $this->server .’:’. $this->port);
return NULL;
куда еще посмотреть?
- Drupal 6
- Блог
- Войдите или зарегистрируйтесь, чтобы отправлять комментарии
Комментарии
Дело в php, в денвере он урезанный
сенкс! =) честно говоря что-то такое и думал.. тогда вытекающий вопрос: можно ли в денвере это поправить, или чот другое ставить?
На сайте денвера был когда — то PEAR, возможно LDAP-функции входят в него, попробуйте поставить. Но я не уверен на 100% что поможет
сенк! после установки и настройки PEARL ldap таки заработал! осталось разобраца с его настройкой =)