If this error is on RHEL7 (CentOS7) due to restrictions prohibiting SELinux, HTTPD can be used.
In the list of allowed default LDAP ports 389 and 636, you can unlock:
setsebool -P httpd_can_network_connect 1
You can test the restriction by trying the socket on the LDAP server:
fsockopen('LDAP-Server-IP', 389);
He will give "Permission Denied", indicating that he is blocked, not a question.
Also check the SELinux audit log file to block other things.
Whoisrich
source share