note 23568 added to function.ldap-start-tls
| From: | wirges-at-cerias.purdue.edu@php.net | Date: | Tue, 23 Jul 2002 00:19:34 +0000 |
| Subject: | note 23568 added to function.ldap-start-tls | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-33393@lists.php.net to get a copy of this message | ||
It should be mentioned, that TLS connections for LDAP *REQUIRE* you to use LDAP Protocol version 3.
By default, PHP uses Protocol 2.
Therefore, if you do not know this, you may be puzzled as to why you get "TLS not
supported" error.
To get around this, just use ldap_set_option to make the LDAP connection use Protcol 2 (if
supported).
For example:
$ds = ldap_connect($LDAP_SERVER,$LDAP_PORT);
if ($ds) {
if (!ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)) {
fatal_error("Failed to set LDAP Protocol version to 3, TLS not supported.");
}
if (!ldap_start_tls($ds)) {
fatal_error("Ldap_start_tls failed");
}
// now we need to bind anonymously to the ldap server
$bth = ldap_bind($ds);
//make your query
}
--
http://www.php.net/manual/en/function.ldap-start-tls.php
http://master.php.net/manage/user-notes.php?action=edit+23568
http://master.php.net/manage/user-notes.php?action=delete+23568
http://master.php.net/manage/user-notes.php?action=reject+23568