PHP LDAP error – Can’t contact LDAP server

Solution for PHP LDAP error – Can’t contact LDAP server
is Given Below:

I have a web app in Windows 2012 that uses LDAP. I copied every file and moved to another Windows 2016 server. The LDAP authentication works fine in Windows 2012 with PHP 5.3. The new server Windows 2016 has PHP 7.4. Therefore, except for the version of Windows and PHP everything is the same. I have added php_ldap.dll to the ExtensionList in php.ini. But I still cannot figure out why it still gives ‘error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed (unable to get local issuer certificate)’.

Do I need to configure something in Windows 2016 for LDAP to work? When I check phpinfo LDAP Support is enabled. The code works perfectly in Windows 2012, but not in 2016. What am I missing? I spent half a day to figure this out. Please help.