Bug #17350 Updated: ldap_bind not working for servers running on ports other than the default
| From: | venaas@php.net | Date: | Fri, 21 Jun 2002 19:24:16 +0000 |
| Subject: | Bug #17350 Updated: ldap_bind not working for servers running on ports other than the default | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-11729@lists.php.net to get a copy of this message | ||
ID: 17350
Updated by: venaas@php.net
Reported By: john.canavan@redbrick.dcu.ie
-Status: Open
+Status: Closed
Bug Type: LDAP related
Operating System: RedHat 7.3
PHP Version: 4.1.2
New Comment:
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).
Previous Comments:
------------------------------------------------------------------------
[2002-05-21 23:21:00] john.canavan@redbrick.dcu.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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=17350&edit=1