osixia / docker-phpLDAPadmin

phpLDAPadmin container image 🐳🌴
MIT License
844 stars 197 forks source link

ldap_connect() error when specifying LDAP server port #14

Closed jamshid closed 7 years ago

jamshid commented 8 years ago

Not sure if the problem is my usage, the docker script, or phpLDAPadmin, but this fails:

docker run -p 443:443 -e PHPLDAPADMIN_LDAP_HOSTS=myproject_apacheds_1:10389 osixia/phpldapadmin

with this error when I try to do an anonymous login:

    Error
E_WARNING: ldap_connect(): Could not create session handle: Bad parameter to an ldap routine
PHP Debug Backtrace
File    /var/www/phpldapadmin/lib/functions.php (184)
    Function    error (a:5:{i:0;s:92:"E_WARNING: ldap_connect(): Could no...)
File    /var/www/phpldapadmin/lib/functions.php ()
    Function    app_error_handler (a:5:{i:0;i:2;i:1;s:81:"ldap_connect(): Could not c...)
File    /var/www/phpldapadmin/lib/ds_ldap.php (165)
    Function    ldap_connect (a:1:{i:0;s:22:"caringo71_ldap_1:10389";})
File    /var/www/phpldapadmin/lib/ds_ldap.php (278)
    Function    connect (a:3:{i:0;s:4:"anon";i:1;b:0;i:2;b:0;})
File    /var/www/phpldapadmin/htdocs/login.php (25)
    Function    login (a:3:{i:0;N;i:1;N;i:2;s:4:"user";})
File    /var/www/phpldapadmin/htdocs/cmd.php (59)
    Function    include (a:1:{i:0;s:38:"/var/www/phpldapadmin/htdocs/login....)

As a workaround, change your LDAP container's port to the default LDAP port 389 or run "socat":

LDAP=$(docker run -d -p 389:389 bobrik/socat TCP-LISTEN:389,fork,reuseaddr TCP:myproject_apacheds_1:10389)
docker run -p 443:443 -e PHPLDAPADMIN_LDAP_HOSTS=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' $LDAP) osixia/phpldapadmin