note 94815 added to function.ldap-start-tls

From: Date: Thu, 26 Nov 2009 11:04:24 +0000
Subject: note 94815 added to function.ldap-start-tls
Groups: php.notes 
Request: Send a blank email to php-notes+get-163299@lists.php.net to get a copy of this message
INTEGRATING ACTIVE DIRECTORY WITH PHP-LDAP AND TLS ================================================== My configuration: Apache/2.2.14 (Win32) mod_ssl/2.2.14 OpenSSL/0.9.8k PHP/5.2.11 NOTE 1: At the momment, the versión 5.3.1 fail with tls NOTE 2: This example works on windows, but in linux is similar 1) Download the Certificate X.509 (PEM format) from a web browser, I used Firefox. I put the name webcert.crt 2) Create the folder c:\openldap\sysconf 3) Copy the file webcert.crt to c:\openldap\sysconf 4) With notepad you must create the file c:\openldap\sysconf\ldap.conf file. The file contents: TLS_REQCERT never TLS_CACERT c:\openldap\sysconf\webcert.crt 5) The code: <?php $ldap="ldap.myDomain.com"; $usr="user@myDomain.com"; $pwd="mypassword"; $ds=ldap_connect($ldap); $ldapbind=false; if(ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)) if(ldap_set_option($ds, LDAP_OPT_REFERRALS, 0)) if(ldap_start_tls($ds)) $ldapbind = @ldap_bind($ds, $usr, $pwd); ldap_close($ds); if(!$ldapbind) echo "ERROR"; else echo "OK"; ?> ---- Server IP: 80.64.47.13 Probable Submitter: 161.67.132.9 ---- Manual Page -- http://www.php.net/manual/en/function.ldap-start-tls.php Edit -- https://master.php.net/note/edit/94815 Del: integrated -- https://master.php.net/note/delete/94815/integrated Del: useless -- https://master.php.net/note/delete/94815/useless Del: bad code -- https://master.php.net/note/delete/94815/bad+code Del: spam -- https://master.php.net/note/delete/94815/spam Del: non-english -- https://master.php.net/note/delete/94815/non-english Del: in docs -- https://master.php.net/note/delete/94815/in+docs Del: other reasons-- https://master.php.net/note/delete/94815 Reject -- https://master.php.net/note/reject/94815 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#163299) next »