note 128898 added to function.ldap-bind
| From: | ChristianStoller at main dot php dot net | Date: | Tue, 19 Sep 2023 09:09:58 +0000 |
| Subject: | note 128898 added to function.ldap-bind | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220858@lists.php.net to get a copy of this message | ||
When using LDAP with SSL and a LDAP server which uses a self-signed SSL certificate the connection
may fail with the error "Can't contact LDAP server". To make the connection work, use
the options to point to the public cert file (see https://www.php.net/manual/en/ldap.constants.php).
Alternatively you can disable the certification check. But keep in mind that this is a security risk
if the connection is routed over a public network!
This is achieved by:
<?php
$ds = ldap_connect('ldaps://myhost:636');
ldap_bind($ds, '{your_ldap_dn}', '{your_ldap_password}')
ldap_set_option($ds, LDAP_OPT_X_TLS_REQUIRE_CERT, LDAP_OPT_X_TLS_ALLOW);
?>
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.157.134 (proxied: 2001:678:4a8:100:222e:f16d:1889:a7b1)
----
Manual Page -- https://php.net/manual/en/function.ldap-bind.php
Edit -- https://main.php.net/note/edit/128898
Del: integrated -- https://main.php.net/note/delete/128898/integrated
Del: useless -- https://main.php.net/note/delete/128898/useless
Del: bad code -- https://main.php.net/note/delete/128898/bad+code
Del: spam -- https://main.php.net/note/delete/128898/spam
Del: non-english -- https://main.php.net/note/delete/128898/non-english
Del: in docs -- https://main.php.net/note/delete/128898/in+docs
Del: other reasons-- https://main.php.net/note/delete/128898
Reject -- https://main.php.net/note/reject/128898
Search -- https://main.php.net/manage/user-notes.php