connect to ldap secure google from php gives error Unable to start TLS

  ldap, php

I’m trying to connect to in php 7.3 but I get an error: "Warning: ldap_start_tls(): Unable to start TLS: Connect error"

my code:

ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
$ldap = ldap_connect('');
ldap_set_option(NULL, LDAP_OPT_X_TLS_CERTFILE, "Google_xxxxx.crt");
ldap_set_option(NULL, LDAP_OPT_X_TLS_KEYFILE, "Google_xxxxx.key");
ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);

my cert file and key file are both located in the same folder.

I’m using Xampp on a windows 10 machine.

I have tried to change:

$ldap = ldap_connect('');


$ldap = ldap_connect('ldaps://',636);

but I still get the same error.

If somebody knows what is wrong with the code, thanks!

Source: Ask PHP