Suporte a LDAP no PHP não é habilitado por padrão. É necessário usar a opção de configuração --with-ldap[=DIR] na compilação do PHP para habilitar o suporte a LDAP. DIR é o diretório base de instalação do LDAP. Para habilitar suporte SASL, certifique-se que --with-ldap-sasl[=DIR] seja usado, e que o arquivo sasl.h exista no sistema.

Nota: Nota aos usuários Win32

Para que esta extensão funcione, existem arquivos DLL que devem estar disponíveis no PATH do sistema Windows. Para saber como fazer isso, veja a FAQ intitulada "Como eu adiciono o meu diretório PHP ao PATH do Windows". Embora copiar arquivos DLL da pasta do PHP para o diretório system do Windows também funcione (porque o diretório system está, por padrão, no PATH do sistema), isso não é recomendado. Esta extensão requer que os seguintes arquivos estejam no PATH: libeay32.dll e ssleay32.dll, ou, a partir do OpenSSL 1.1 libcrypto-*.dll e libssl-*.dll

Para usar as bibliotecas LDAP da Oracle, um ambiente Oracle adequado deve ser definido.

add a note

User Contributed Notes 11 notes

11 years ago
I found not only "Versions before PHP 4.3.0 additionally require libsasl.dll.".

If you use php-5.3.3-Win32-VC9-x86 or later Versions that
It's require libsasl.dll.

Running under Windows & Apache 2.2.8
PHP file is download from

When I use php-5.2.x-Win32-VC6-x86 and php-5.3.x-Win32-VC6-x86

1.just uncomment extension=php_ldap.dll in php.ini
2.Restart apache,it's ok

When I use php-5.3.x-Win32-VC9-x86 and php-5.4.x-Win32-VC9-x86

1.just uncomment extension=php_ldap.dll in php.ini
2.Restart apache,always fail...
(only php-5.3.1-Win32-VC9-x86 & php-5.3.2-Win32-VC9-x86 is ok. )

[php-5.3.3-Win32-VC9-x86 or later Versions]
1.just uncomment extension=php_ldap.dll in php.ini
2.copy libsasl.dll to [apache folder]\bin
3.Restart apache,it's ok
12 years ago
If using a debian machine (debian or ubuntu variants) just do apt-get install php5-ldap, that's all to get ldap work on php. No need to get sources, try to compiling them and so on.
p38fln at msn dot com
4 years ago
On newer versions of Windows and Windows Server, if you've installed PHP from the Microsoft Web Platform Installer (PI) then all you have to do is add extension=php_ldap.dll to the extensions section and restart IIS.
9 years ago
OCI client from Oracle distributes un ldap.h which may collision with the SO ldap.h.
You can, remove the Oracle ldap.h and build or configure php without oci8 and then add OCI8 later as a shared extension.
This latter step is easiest using PECL: pecl install oci8. You will then need to add '' to your php.ini.
tom at wheelercreek dot com
15 years ago
If you're running on Windows XP with Apache, and you installed PHP 5 from the windows installer rather than the full zipped version - you may not have the php_ldap.dll file.

I had to follow the steps above, making sure PHP was added to my Windows Path, adding the 2 dll files to the system32 directory, also making sure the php.ini extensions directory was set correctly (in my case: C:\Program Files\PHP\ext).

Still was a getting a message about not being able to locate the "php_lamp.dll" file. I finally went back, downloaded the full .zip file of latest PHP version, and that missing dll file is included there - along with many others.

Remember to restart Apache server after you do all this.
10 years ago
To enable PHP LDAP for IIS, I installed PHP Manager which integrates with IIS. Open this up and you can enable/disable extensions. Enable php_ldap.dll and it works straight away.
silver dot alecs at yahoo dot com
10 years ago
The easiest way to install ldap extension on Ubuntu 12.04 is:

sudo apt-get install php5-ldap

Also don't forget to laod the extension.
tomasz() trejderowski!pl
10 years ago
I can confirm Frank's note (made 1 year ago, see below) about requirement of "libsasl.dll" library. I have "PHP Version 5.4.7" and my Apache fails to restart with error saying, that "libsasl.dll" is missing, once I enable php_ldap.dll extension in PHP configuration.

What is even more strange, I DO HAVE this library (along with required "ssleay32.dll" and "libeay32.dll" in my PHP's directory and my PHP's directory IS listed in Windows' PATH variable and even so, I'm facing the problem of Apache failing to start.

The only workaround, I found is to copy "libsasl.dll" to "system32" system directory. Solution, that PHP documentation here discourages.

So, to summarize, section "Note to Win32 users" is twice wrong. You DO have to have "libsasl.dll" directory and you have to place it in your system folder.
tom at wheelercreek dot com
15 years ago
Sorry - I was referring to "php_ldap.dll", not php_lamp.dll
9 years ago
Runing in IIS 8.5 on Server 2012 R2 I tried to install PHP Manager same as nesbittp needed to install Dot Net 3.5 and HTTP Activation first then installed without issue.
chealer at gmail dot com
8 years ago
Users of the "WAMP Server" software need to enter PHP's path... as the documentation says. Although apache\apache[...]\bin\ also contains the files mentioned, this does not suffice for some reason.
For me, the path is C:\wamp\bin\php\php5.5.12
To Top