1

Environment:

LDAP Server Type: ActiveDirectory

LdapRecord-Laravel Major Version: v2.5

PHP Version: 8.0

I'm using ldaprecord and I'm getting

"ldap_bind(): Unable to bind to server: Can't contact LDAP server. Error Code: [-1" 

when I run php artisan ldap:test , can you help me how I can fix this bug knowing that I'm using xammp , thanks a lot

Connection | Successful | Username | Message | Response Time |
+------------+------------+----------+-------------------------------------------------------------------------------------------------------------+---------------+
| default | ✘ No | | ldap_bind(): Unable to bind to server: Can't contact LDAP server. Error Code: [-1] Diagnostic Message: null | 10082.94ms |
Rob
  • 1,175
  • 1
  • 7
ZOHBOU
  • 11
  • 1
  • 2
  • You'd need to share some configuration and tell us more about your environment. – Manu Jul 11 '22 at 08:43
  • im using connection with the env , and im working on windows with xampp this is my env.file LDAP_LOGGING=true LDAP_CONNECTION=default LDAP_CONNECTIONS=default LDAP_DEFAULT_HOSTS=ldap.forumsys.com LDAP_DEFAULT_USERNAME=null LDAP_DEFAULT_PASSWOR=null LDAP_DEFAULT_PORT=389 LDAP_DEFAULT_BASE_DN="cn=read-only-admin" LDAP_DEFAULT_TIMEOUT=5 LDAP_DEFAULT_SSL=false LDAP_DEFAULT_TLS=false – ZOHBOU Jul 11 '22 at 08:57
  • thnaks manu i got this and i dont know how i suppose interpret this ComputerName : ldap.forumsys.com RemoteAddress : 64:ff9b::6b17:a2de RemotePort : 389 InterfaceAlias : Wi-Fi SourceAddress : 2a04:cec0:c016:8d68:5867:9f9e:a97b:9c7b TcpTestSucceeded : True – ZOHBOU Jul 12 '22 at 14:37
  • this means, that regarding the network connection there is everything fine. Do you have an actual Active Directory to test it on rather than this public test LDAP service? – Manu Jul 13 '22 at 09:07
  • I am also having the same issue when upgraded to XAMPP 8.2.4. When I was using 8.0.0.0 I was using security 636 port. I am using the same on my current new server but it is giving me the same error your getting @ZOHBOU – JukEboX May 09 '23 at 11:20
  • @ZOHBOU Did you find an answer to this question? – JukEboX May 25 '23 at 11:44

2 Answers2

0

See this example

You'll need to set a proper user and password for LDAP_DEFAULT_USERNAME and LDAP_DEFAULT_PASSWORD.

Your LDAP_DEFAULT_BASE_DN is not supposed to be a user, rather the OU you want to enter with LDAP which contians everything you want to query.

Example for the whole domain: "dc=local,dc=com"

Also make sure your domain controller is reachable on TCP 389 from your system.

Manu
  • 789
  • 4
  • 19
  • 1
    thanks for your answer but still it dont work i think the porblem is in the ssl/tls and im using xampp i dont know how to ad a ldap.conf in my server directory – ZOHBOU Jul 11 '22 at 10:24
  • By default LDAP on Port 389 is not encrypted and does not require ssl/tls. Check first for connectivity to this port. Example in Powershell: Test-Netconnection -Computername ldap.forumsys.com -Port 389 – Manu Jul 11 '22 at 10:26
0

I was getting an error like this on Red Hat Server due to selinux.

Running this on the server fixed the issue:

setsebool -P httpd_can_connect_ldap on
Bastion
  • 127
  • 4