I have an LDAP server runs on:
ldap://roshd.org:389 where roshd.org =

I have this configuration in config.php in phpldapadmin:

$servers = new Datastore();
$servers->setValue('server','name','My LDAP Server');

in my sldap.conf:

database    bdb
directory   /usr/local/var/openldap-data
suffix      "dc=roshd,dc=org"
rootdn      "cn=Manager,dc=roshd,dc=org"
rootpw      secret

but when I attemp to login in phpldapadmin, I got this error. is there any idea?

Unable to connect to LDAP server My LDAP Server
Error: Can't contact LDAP server (-1) for user
error   Failed to Authenticate to server
Invalid Username or Password.

  • 1
    +1 for a well written question! – geoffc Jan 23 '11 at 19:20
  • Did you ever resolve this? – Cerin Mar 22 '11 at 20:44
  • @Chris : no I just install iRedmail CentOS and use it's preconfigured OpenLDAP – Mohammad Ali Akbari Mar 25 '11 at 14:40

Spot the difference:




I suspect that the rootpw is either expected to be stored encrypted, and you have it clear text, in which case it is expecting perhaps a different result. (I.e. The hashed value of secret is being sent and being compared to the clear text string secret.)

  • 1
    I think no, there is another option for SASL Authentication in config.php, but I will try it – Mohammad Ali Akbari Jan 23 '11 at 19:53

If you are authenticating against ldap itself, you might want to check this setting: $servers->setValue('login','attr','uid');

/* If you specified 'cookie' or 'session' as the auth_type above, you can
   optionally specify here an attribute to use when logging in. If you enter
   'uid' and login as 'dsmith', phpLDAPadmin will search for (uid=dsmith)
   and log in as that user.
   Leave blank or specify 'dn' to use full DN for logging in. Note also that if
   your LDAP server requires you to login to perform searches, you can enter the
   DN to use when searching in 'bind_id' and 'bind_pass' above. */
// $servers->setValue('login','attr','dn');

On CentOS 7 i get the same error, since SELinux does restrict access to ldap from httpd...

setsebool -P httpd_can_connect_ldap on

did the trick...


I had the same issue. You can check below.

  1. Check If you have right ipaddress in $servers->setValue('server','host','ipaddress'); in ldap.conf file. and restart tomcat server. Cheers.

  2. Check if user you are trying to login with exist or not using "ldapsearch -x" on terminal.

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.