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 8498021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:17:20+00:00 2026-06-11T00:17:20+00:00

I have a PHP script on an apache server, and every time I try

  • 0

I have a PHP script on an apache server, and every time I try to run it, it tells me:

unable to bind to the AD

It connects fine though. I took it off the apache server, and ran it locally from my machine, and it was able to bind just fine. I’m assuming that there is something wrong with my configuration of apache.

I’m using the adLDAP API, and this is the following script I’m trying to run. It’s basically a test to see whether I’m able to bind successfully or not and check to see if the credentials entered are in the Active Directory.

$username = $_POST["username"];
$password = $_POST["password"];
$formage =  $_POST["formage"];

if ($_POST["oldform"]) { //prevent null bind

    if ($username != NULL && $password != NULL){
        //include the class and create a connection
        include (dirname(__FILE__) . "/../src/adLDAP.php");
        try {
            $adldap = new adLDAP();
        }
        catch (adLDAPException $e) {
            echo $e;
            exit();
        }

        //authenticate the user
        if ($adldap->authenticate($username, $password)){
            //establish your session and redirect
            session_start();
            $_SESSION["username"] = $username;
            $_SESSION["userinfo"] = $adldap->user()->info($username);
            $redir = "Location: https://" . $_SERVER['HTTP_HOST'] .
                dirname($_SERVER['PHP_SELF']) . "/menu.php";
            header($redir);
            exit;
        }
    }
    $failed = 1;
}

Why am I getting this error: unable to bind to the AD?

  • 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-06-11T00:17:21+00:00Added an answer on June 11, 2026 at 12:17 am

    I figured out the issue.

    Apparently SELinux was blocking the port I needed to connect to, so I just essentially told SELinux that it’s ok to connect to that port. Now everything works like a charm. Here is how I allowed Apache access to the port:

    grep httpd /var/log/audit/audit.log | audit2allow -M mypol
    semodule -i mypol.pp
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a php script that needs to run for quite some time. What
I have a php script http://example.com/myapp/myscript.php running on an Apache server. I call this
I have an Apache server running a PHP script that receives data via a
I have a PHP script running on my LAMP server that requires certain files
I'm trying to get a PHP script to run every 30 minutes on my
I have php_mod and an apache server. If I start a script from the
I'm stuck using an Apache server with an older php version. it doesn't have
I have installed my PHP scripts which runs over Apache server in a Windows
I have a php script which contains su. when I run it in shell
I have a PHP script that receives uploads and it works fine in mamp,

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.