I'm looking to get ldap_connect with work correctly. It'll work fine via CLI, although not after i open my php file via browser.

Here's what In my opinion would be the relevant particulars:

  • Error message: Fatal error: Call to undefined function ldap_connect() in F:Websitesldap.php online 4
  • OS: Home windows Server 2008 R2 x64
  • PHP Directory: C:Program Files (x86)PHP
  • libeay32.dll and ssleay32.dll happen to be put into both C:Program Files (x86)Apache Software FoundationApache2.2bin and C:WindowsSystem32. These were replicated from C:Program Files (x86)PHP.

Lines put into httpd.conf:

  • LoadModule php5_module "C:/Program Files (x86)/PHP/php5apache2_2.dll"
  • AddType application/x-httpd-php .php
  • PHPIniDir "C:/Program Files (x86)/PHP"

Things transformed in php.ini:

  • extension_dir = "C:/Program Files (x86)/PHP/ext" (path set)
  • extension=php_ldap.dll (uncommented this line)

I am tugging my hair out, and so i am more than pleased to test anything people suggest.

Your PHP installation uses two different ini files Body when running in the command line, and another when running through Apache. This really is evidenced because it really works in the CLI, although not inside a browser.

You'll find the pathways towards the two files using phpinfo() (inside a browser) by passing the -i flag to php in the command line. Presents itself both teams of output there is a road to the ini file being used, and that i could be mighty surprised when they were identical. In the command line you will get more in depth information by passing the --ini flag.

Because you are becoming Call to undefined function ldap_connect() can only imply that the LDAP extension wasn't loaded, which are only able to be true through Apache although not with the CLI when they use two different ini files.

Personally i think silly now. The issue was with adding my PHP directory towards the PATH atmosphere variable. I am not 100% sure why it fixed the issue, but which was what wound up doing the work. Just help, men!