ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-windows
php-windows
[PHP-WIN] Using PHP to Bind over LDAPS.
by Phillip Terry other posts by this author
Oct 19 2006 9:42AM messages near this date
Re: [PHP-WIN] PHP_PRINTER.DLL prints from shell but not from web | RE: [PHP-WIN] Using PHP to Bind over LDAPS.
I configured LDAP for SSL (LDAPS) on the Active Directory (AD) Domain Controller (DC).
The DC is a Windows 2003 Server box.

To do this I:
1) Setup the DC as a Certificate Authority (CA)
2) Issued a Certificate to itself
3) Issued a Certificate to the client that would be connecting via LDAPS

The client is configured in the following manner:
1) Windows 2003 Server Running IIS
2) PHP 5.0.4 installed
3) LDAP support enabled
    - Uncommented the php_ldap.dll extension
    - Copied the php_ldap.dll file into the appropriate directory
    - Restarted IIS

Using the LDP tool, I was able to connect and bind via ports 389, 636, and 3269.

Here is the code I am using to attempt the bind:


<?php

$host = "ldaps://server.addomain.domain.com";
$un = "jdoe";
$pw = "password";

$lc = ldap_connect($host);

ldap_set_option($lc, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($lc, LDAP_OPT_REFERRALS, 0);

$lb = ldap_bind($lc, $un, $pw);

ldap_close($lc);

?> 


If I change it to ldap://server.addomain.domain.com it functions correctly.

Is there a secure bind function I should know about?

Thanks for the help!

Phillip
Thread:
Phillip Terry
Zeb Bowden
Phillip Terry

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved