I am using a system where I do not have write access to the /etc/openldap/ldap.conf file. Furthermore, I am trying to authenticate against an ldaps:// Active Directory server. Unfortunately, the key file is unsigned.

Therefore, I need to be able to set the following config parameter to allow PHP to access the LDAP server:


Can someone tell me how I can debug this, to see why PHP is not using the same setting as ldapsearch? (ldapsearch works after I insert this setting in my ~/.ldaprc file)

Much appreciated,



PHP is running as a different user - eg www-data on Debian/Ubuntu. So you need to put .ldaprc in the home directory of that user.

  • Actually PHP is running as my users because I have done --prefix=/home/myuser – g33kz0r Jul 1 '09 at 18:14
  • 2
    --prefix specifies the location where PHP is, not as what user it's running. – grawity Jul 2 '09 at 11:20
  • OK. Try stracing php on the command line like so: strace -e open php then <? $lc=ldap_connect("ldap://server"); ldap_set_option($lc, LDAP_OPT_PROTOCOL_VERSION, 3); ldap_bind($lc,'',''); ?> and see which files it opens. On my system it tries three locations for ldaprc including the local directory. – TRS-80 Jul 3 '09 at 3:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.