Hi, Pete,
Most likely, the ldap_connect() function is working properly. I bet it's
returning a resource.
On the next line after ldap_connect(), add the line:
var_dump($ldapconn);
and you'll see something like this:
resource(1) of type (ldap link)
Even though you used a fake host name, ldap_connect() will return a
resource.
You'll find out if the host is valid when you follow up with ldap_bind().
Examples here:
[1]
http://www.php.net/manual/en/function.ldap-bind.php
Alan
On 1/19/2012 1:32 AM, Pete Helgren wrote:
This one has me scratching my head a little.
I installed osTicket on i so a customer of mine can enter support
tickets that I can manage for them. One of the options is to use LDAP
for authentication and the web site shows some simple hacks to get it to
work. Cool. So I hacked the files and still can't authenticate. So, I
decided just to create a simple script that will just verify that I am
hitting the AD server. Still nothing. Not even an error. So here is
the code I used just to kick the tires and see if I can hit the AD:
<?php
// LDAP variables
$ldaphost = "xxxxxxxxxxxx"; // 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");
?>
So when I run this script, I get nothing. Blank page. No errors. Even
though the host name is xxxxxxxxxx (and yes, that is the actual
character value I passed as host - all x's). Any one using LDAP in a
PHP app on i? Any pointers? And, why don't I see any errors? php.ini
has display_errors = On and error_reporting = E_ALL
References
Visible links
1.
http://www.php.net/manual/en/function.ldap-bind.php
As an Amazon Associate we earn from qualifying purchases.