I\'m trying to authenticate over LDAP against a Windows 2008 Server from a Fedora box.
The following code works from the command line (prints \"Success\"):
You might be having this problem because Apache has one php.ini file and CLI might have another, and the Apache version might not have LDAP extension enabled.
Try checking which php.ini is loading with phpinfo() in both of your environments:
You should see the path of php.ini and additional useful information:
Configuration File (php.ini) Path => /etc/php5/cli
Loaded Configuration File => /etc/php5/cli/php.ini
Scan this dir for additional .ini files => /etc/php5/cli/conf.d
An alternative method to see the configuration loaded on the CLI is by calling php with -i parameter:
$ php -i | grep 'php.ini'
Configuration File (php.ini) Path => /etc/php5/cli
Loaded Configuration File => /etc/php5/cli/php.ini