How to enable LDAP extension for PHP in Ubuntu

16,737

Solution 1

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.

Solution 2

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.

Share:
16,737
baig772
Author by

baig772

For the past 12+ years, I have been working in the industry, leading the way into what are now well-known technologies. For the past 6 years, I have been building and heading a team focused on Agile Development Practices using the Accelerate Strategies, as well as modern technologies and workflows such as Laravel, AWS ECS, AWS Serverless. Lambda, Elastic Search, ReactJS, VueJS, Continuous Integration and Deployment and more. During those years, I have led numerous releases of projects with teams ranging from just me to 20+ people. My most recent work has allowed the team to perform at elite levels. Each project pushes the technology stack we use, the skills of the team, and the possibilities of the Web Applications that we can create.

Updated on June 17, 2022

Comments

  • baig772
    baig772 almost 2 years

    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

    • Rathan Naik
      Rathan Naik over 6 years
      Are you getting any errors ?
    • baig772
      baig772 over 6 years
      Yes, Fatal Error: Call to an undefined function ldap_connect
    • baig772
      baig772 over 6 years
      Yes, Fatal Error: Call to an undefined function ldap_connect
    • Rathan Naik
      Rathan Naik over 6 years
      Does sudo apt-get install php5-ldap install successfully ? @baig772
    • baig772
      baig772 over 6 years
      it said unable to locate php5-ldap but i did sudo apt-get install php-ldap and it worked
    • Rathan Naik
      Rathan Naik over 6 years
      Did you restart apache ? /etc/init.d/apache2 restart
    • baig772
      baig772 over 6 years
    • CodeConnoisseur
      CodeConnoisseur over 4 years
      I ran sudo apt-get install php5.6-ldap to get it for a specific php version then restarted apache and it worked (Ubuntu 18.04)
  • baig772
    baig772 over 6 years
    I think this should be in comments sections. It is quite obvious that one always restarts the apache whenever apache or php related installation is done
  • blaimi
    blaimi over 6 years
    OT: I'm currently collecting reputation points by answering questions to get the 'comment everywhere'-permission …