31

I have recently upgraded Ubuntu to version 16.04 and PHP to version 7. However, the ldap connection is not working.

How to enable ldap in PHP 7?

rlandster
  • 7,294
  • 14
  • 58
  • 96
Wings2fly
  • 887
  • 1
  • 11
  • 31
  • 1
    Is the LDAP-Extension available and enabled in PHP? Do you see ```ldap``` being mentioned in a ```phpinfo```-output? For me it looks like PHP is not available. But from that little information I can'T really say anything more – heiglandreas Sep 30 '16 at 11:08

3 Answers3

54

To install ldap on a lamp with PHP version 7.0 (or 7.1):

  • apt-get install php7.0-ldap (or use apt-get install php7.1-ldap )
  • service apache2 restart
  • After that create a php file to get the php configuration phpinfo();
  • Now ldap is installed.
MeSo2
  • 450
  • 1
  • 7
  • 18
NIDIA RAMIREZ
  • 555
  • 5
  • 6
46

Providing the php version number is no more required:

apt-get install php-ldap

Is enough now, the correct package version will be automatically installed.

PS: Note that is it true if you use the standard php packages provided by your distribution. If you are using an additional ppa for PHP like the sury one, you will have to specify the version number as there are multiple versions available.

COil
  • 7,201
  • 2
  • 50
  • 98
  • 1
    This one works if you have the latest PHP installed. :) I needed one for a previous version. +1 for a good answer! – cbloss793 Jan 09 '19 at 18:49
3

install both php ldap for your specific php version, mine was

sudo apt install php7.2-ldap php-ldap -y

it solves the problem i was having

Bekti Galan
  • 81
  • 2
  • 8