php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17350 ldap_bind not working for servers running on ports other than the default
Submitted: 2002-05-21 23:21 UTC Modified: 2002-06-21 15:24 UTC
Votes:4
Avg. Score:3.8 ± 1.6
Reproduced:1 of 3 (33.3%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: john dot canavan at redbrick dot dcu dot ie Assigned:
Status: Closed Package: LDAP related
PHP Version: 4.1.2 OS: RedHat 7.3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: john dot canavan at redbrick dot dcu dot ie
New email:
PHP Version: OS:

 

 [2002-05-21 23:21 UTC] john dot canavan at redbrick dot dcu dot ie
When running OpenLdap on a port other than the default 389, ldap_bind fails to function - giving the following error message -

Warning: LDAP: Unable to bind to server: Can't contact LDAP server in /var/www/html/connext.phtml on line 29

The related php section of connext.phtml being -

<?php

echo "begin php block code .....<br><br>\n";
$host = "ldap://ip.goes.here";
$port = 37337;

$binddn = "cn=Manager, o=netfaves, c=ie";
$bindpw = "secret";

$check = ldap_connect( $host, $port );
echo "check = " ;print("$check <br>");

if($check)
        {
        echo "Connected successfully <br><br>\n";

        $bindcheck = ldap_bind( $check, "cn=Manager, o=netfaves, c=ie", "secret" );
        print("bindcheck = '$bindcheck'<br>");
        if ($bindcheck)
                echo "Succesfully Bound<br><br>\n";
        else
                echo "No luck this time buddy...<br><br>\n";

        }
else
        echo "Error! Could not connect to ldap host $host<br>\n";

echo "....end php block code <br><br>\n";
?>

ldap_connect functions as expected here and returns "Resource id #1".

When I restart slapd, this time running on port 389, ldap_bind has no problem connecting and returning "1". I tried running slapd on various other high ports, each time getting the same error message. This pretty much means that you need to run slapd as root to  be able to interact with it via php.

I had a quick look through the source but couldn't pinpoint anything that might be at fault - but my C isn't the best anyway.

I had the same problem with php 4.2.1 aswell, but haven't had the chance to try reproduce it.

Regards,
John Canavan


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-21 15:24 UTC] venaas@php.net
If you use URL syntax, you must supply the port number in
the URL. This is noted in the manual for ldap_connect().
So try either ldap_connect("ip.goes.here", "37337") or
ldap_connect("ldap://ip.goes.here:37337").

I'm closing this case then, reopen or let me know if for
some reason this doesn't help (I'm pretty sure it does).

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 21 10:01:30 2024 UTC