I found the reason it was not working. Turns out that the LDAP server that I was connecting to does not allow anonymous bind, so I had to specify the user name and password for to bind to the server.
Once I provided LDAPBindUser and LDAPBindPassword in the LDAP.ini file, it started working fine.