I have a php login form localhost and I want to use the same username/password that I have when I open my computer instead of create new password. While I was searching this, I read that I must use LDAP .But I need your help because is existing a mess and I am confused.
Asked
Active
Viewed 49 times
1 Answers
0
1st, it call Active Directory (AD). Yes in order to allow communicate PHP to communicate to AD, you will use LDAP lib.
Make sure:
- AD Domain Controller (DC) allow 3rd party communication; eg server firewall.
- PHP compiled with LDAP library, enabled.
- Have details such as Path, DC & Domain Name (DN) string.
Then either use:
- Community classes: https://github.com/adldap/adLDAP, or
- https://maychia.wordpress.com/2012/10/08/how-tophp-ldap-authentication-active-directory/
Updated:
- To get the AD IP, try
ipconfig -all
orifconfig -all
; DC normally listed as one of the DNS server(s). - Basic Connection PHP-LDAP https://pastebin.com/GR0gHFXi
- change values on
CONFIG HERE
comments.
- change values on

Ryan Harne
- 469
- 3
- 7
-
How check if AD Domain Controller (DC) allow 3rd party communication? – user8190974 Sep 20 '17 at 10:22
-
1: simple ping. 2: php fsockopen("IP/hostname - if dns-able", 389 or 636, 'str', 'str', 5). 3: php ldap_connect(). – Ryan Harne Sep 21 '17 at 01:38
-
Can you particularly explain me ? – user8190974 Sep 22 '17 at 04:51
-
#1 is just getting the IP, check DNSs server if responding to ping. #2 & #3 in link given above. – Ryan Harne Sep 25 '17 at 02:10
-
Thanks you very much about your help!! – user8190974 Sep 25 '17 at 17:04
-
I use the code from here:https://stackoverflow.com/questions/17773643/using-active-directory-to-authenticate-users-on-intranet-site but when write username and password ,display unable to access:success – user8190974 Sep 28 '17 at 18:12
-
whats the error? note there are domain-name prefix to username.. and username is not email. ie "xyz\user.name" – Ryan Harne Sep 29 '17 at 06:20
-
Firstly i dont have prefix in my fomain. Secondly it is very straight that display unable to access:success with the correct username and password – user8190974 Sep 30 '17 at 15:54
-
so during your troubleshooting everything is ok? post your code, AD structure screenshot.. or something – Ryan Harne Oct 01 '17 at 20:48