Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6862837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:42:35+00:00 2026-05-27T02:42:35+00:00

In PHP, how can you bind using a property other than the default cn?

  • 0

In PHP, how can you bind using a property other than the default cn? (I’m not asking how to validate a user account using LDAP search queries, I’m specifically asking how I can bind using a sAMAaccountname and password in PHP).

In Perl, this is possible by specifying the property to query directly on the LDAP string:

ldap://ldap.example.com/dc=example,dc=com?sAMAccountName 

The php ldap_connect funciton only takes a server name so these additional parameters are not able to be passed. Also the bind function only takes a connection, username, and password.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T02:42:35+00:00Added an answer on May 27, 2026 at 2:42 am

    Connect simply opens the connection it doesn’t set any credentials on the connection. Once the connection is open you bind it to a set of credentials using ldap_bind.

    In connecting to AD you can use 3 different formats for the username.

    1. The DN.
    2. The samAccountName which may or may not need the domain prefixed in
      it as Domain\samAccountName.
    3. The user principal name which has a format that looks similar to an email address.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can PHP PDO extension bind nested objects automatically ? I mean using foreign key
how can I authenticate from PHP using LDAP when I only have the SamAccountName
How can PHP cause memory leaks, buffer overflows, stack overflows and any other errors
In php i can get today date/day by using : $today = date('D, Y-m-d');
I am having a little trouble with my PHP LDAP login. My first bind
I am currently building an MVC application in PHP (not using any frameworks). I
I'm trying to connect in LDAP with php-ldap. I got a issue using ldap_bind()
I built a very simple Twitter Instant Search for fun, using jQuery and PHP.
I was wondering if PHP can do this as there seems to be no
MySQL connection in PHP can be established in two ways: $mysql = new mysqli('localhost',

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.