PHP Fatal error: Call to undefined function: ldap_connect()

Hi,
I keep getting a fatal error with my LDAP connect to Active Directory.  This should be a no brainer but I'm at a loss...

I have a phone book written in PHP.  It calls on a function file.  This use to work and the guy who coded this left the company.  I used a couple of editing programs and still can't figure it out...  I replace real server IP with a fake one & fake account info.  Here's the code:

<?

# define action constants
define( INITIALIZE, 0 );
define( SEARCH, 1 );

function connect_to_server() {

      $ldaphost = "123.45.6.78";
      $ldapport = 389;
      $ldaprdn = 'yikes@mypage.com';
      $ldappass = 'password';

      $ds=ldap_connect($ldaphost ,$ldapport)
            or die("Cannot connect to {$ldaphost}");
      
      if ($ds) {
            // binding to ldap server
            $ldapbind = ldap_bind($ds, $ldaprdn, $ldappass)
                  or die("LDAP bind failed...");
                  }
      return $ds;
}

?>


Any help would be appreciated!  I need to have this fixed ASAP that's why I assigned a high point to this.  Thanks!

res4meAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AVSECCommented:
Hi res4me,

Call to undefined function: ldap_connect() means LDAP probably isn't enabled on your webserver.

To check that it is enabled, run the script

<?php

phpinfo();

?>
and check to see if you have a section regarding LDAP. If you don't, you'll need to enable "extension=php_ldap.dll" in your php.ini file, as well as copying some DLL files as detailed here: http://nz2.php.net/manual/en/ref.ldap.php#ldap.requirements

Hope this helps.


Dave
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.