baig772
baig772

Reputation: 3498

How to enable LDAP extension for PHP in Ubuntu

I am trying to enable LDAP for PHP5.6 on Ubuntu 16.04. I have tried the following steps

 - sudo apt-get install php5-ldap
 - sudo enmod ldap
 - sudo php5enmod ldap 

but still I am unable to get my ldap related functions working with PHP

Upvotes: 2

Views: 24282

Answers (3)

Andrew Koster
Andrew Koster

Reputation: 1835

sudo apt-get install php-ldap

/etc/init.d/apache2 restart

@baig772 answered their own question but they didn't post it as an answer.

Upvotes: 1

senthil sivasamy
senthil sivasamy

Reputation: 382

latest ubunutu php-ldap was not working I tried installing apt-get install php7.0-ldap which is not working, then I download deb https://debian.pkgs.org/sid/debian-main-amd64/php7.2-ldap_7.2.4-1+b2_amd64.deb.html

wget http://ftp.br.debian.org/debian/pool/main/p/php-defaults/php-common_49_all.deb

wget http://ftp.us.debian.org/debian/pool/main/p/php7.0/php7.0-ldap_7.0.29-1+b2_amd64.deb

wget http://ftp.us.debian.org/debian/pool/main/u/ucf/ucf_3.0038_all.deb

then..

apt install ./php7.2-common_7.2.4-1+b2_amd64.deb

apt install ./php7.2-ldap_7.2.4-1+b2_amd64.deb ...

once it is installed confirmed by running the

apt-cache pkgnames | grep ldap | grep php

php-symfony-ldap php7.2-ldap php-net-ldap2 php-net-ldap3


check php enabled modules

:/usr/lib/php/7.2# php -m

ctype curl date dom fileinfo filter ftp gd hash iconv

it does not have ldap module..

so copied .so files

:/usr/local/etc/php# cp /usr/lib/php/20170718/ldap.so /usr/local/lib/php/extensions/no-debug-non-zts-20170718/

enable apache ldap " a2enmod ldap" php-m

now it has ldap module enabled.

[PHP Modules] Core ctype curl date dom fileinfo filter ftp gd hash iconv json ldap libxml mbstring

restart apache and checked in info.php.

/etc/init.d/apache2 stop /etc/init.d/apache2 start

Upvotes: 1

blaimi
blaimi

Reputation: 819

you need to restart your apache (systemctl restart apache2). Apache has its very own single php-process running*. The php-configuration is only reload if apache restarts this process. You can check your active configuration with phpinfo

* this is very simplified and depends on the apache MPM-Module you are using.

Upvotes: 1

Related Questions