Warning: ldap_start_tls() [function.ldap-start-tls]: Unable to start TLS: Server is unavailable in /var/www/html/testldap/index.php on line 13 Ldap_start_tls failed
My configuration is as follows
Centos 5.7 PHP Version 5.3.3
php53-ldap configured. No matter what I try to do , the starttls issue is giving me a headache. Any help would be highly appreciated.
Well, what a fun journey I have been on with this one.
The problem you are having is that your machine does not accept the server's certificate as valid. The simple work around to this is to disable the check, which is done in the ldap.conf file, or with an environment variable.
You can edit the file at
/etc/openldap/ldap.conf
(c:\openldap\sysconf\ldap.conf
on Windows) or create one if it doesn't already exist and put this line in it:...or you can create an environment variable named
LDAPTLS_REQCERT
with the valuenever
.Once I had done either of those things, the following script worked for me:
Annoyingly, neither
putenv('LDAPTLS_REQCERT=never');
nor$_ENV['LDAPTLS_REQCERT'] = 'never';
will work - you have to either create the config file or statically set the variable.If you want to validate the certificates, you will need to do some further reading on how to configure OpenLDAP properly.
Sources for this:
Did you installed PHP --with-ldap[=DIR]?
Also:
Source.