From: [EMAIL PROTECTED] Operating system: RedHat 7.3 PHP version: 4.1.2 PHP Bug Type: LDAP related Bug description: ldap_bind not working for servers running on ports other than the default
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 bug report at http://bugs.php.net/?id=17350&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=17350&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=17350&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=17350&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=17350&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=17350&r=support Expected behavior: http://bugs.php.net/fix.php?id=17350&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=17350&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=17350&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=17350&r=globals