From: Al Mangkok on
Code below from the manual. I changed $ldaphost to some fictitious name.
When I ran the script, I always get the message "Connection was successful
!" Why didn't the script bomb and give the could not connect message?

<?php

// LDAP variables
$ldaphost = "ldap.noname.com"; // your ldap servers
$ldapport = 389; // your ldap server's port number

// Connecting to LDAP
$ldapconn = ldap_connect($ldaphost, $ldapport)
or die("Could not connect to $ldaphost");


print "Connection was successful !";


?>

TIA.

--
al
From: Nathan Rixham on
Al Mangkok wrote:
> Code below from the manual. I changed $ldaphost to some fictitious name.
> When I ran the script, I always get the message "Connection was successful
> !" Why didn't the script bomb and give the could not connect message?
>
> <?php
>
> // LDAP variables
> $ldaphost = "ldap.noname.com"; // your ldap servers
> $ldapport = 389; // your ldap server's port number
>
> // Connecting to LDAP
> $ldapconn = ldap_connect($ldaphost, $ldapport)
> or die("Could not connect to $ldaphost");
>
>
> print "Connection was successful !";
>

http://php.net/ldap_connect

"ldap_connect() will always return a resource as *it does not actually
connect but just initializes the connecting parameters.* The actual
connect happens with the next calls to ldap_* funcs, usually with
ldap_bind()."

:)