Reputation: 171
I have 2 docker containers. Inside of the first docker-container is my lamp application with php-7.3.4, apache2 ; inside of the second one is mysql database.
I've tried to connect ldap server inside first container. I proceed to the 'test-project' folder and configured custom_config.inc.php
$tlCfg->authentication['method'] = 'LDAP';
$tlCfg->authentication['ldap_server'] = 'ldap.xyz.com';
$tlCfg->authentication['ldap_port'] = '389';
$tlCfg->authentication['ldap_version'] = '3';
$tlCfg->authentication['ldap_root_dn'] = 'dc=xyz,dc=com';
$tlCfg->authentication['ldap_bind_dn'] = 'uid=tl,ou=staff,dc=xyz,dc=com';
$tlCfg->authentication['ldap_bind_passwd'] = 'XYZw';
$tlCfg->authentication['ldap_tls'] = false; // true -> use tls
After I have tried to login to the webpage via ldap credentials and throwed http error 500
When I viewed logs I got:
Error: https://i.sstatic.net/hST65.jpg
PHP Fatal error: Uncaught Error: Call to undefined function
ldap_connect() in
var/www/html/testlink/lib/functions/ldap_api.php:42\nStack trace :\n#0
/var/www/html/testlink/functions/ldap_api.php(165):
ldap_connect_bind(Array)\n#1
var/www/html/testlink/lib/functions/doAuthorize.php(200):
ldap_authenticate('test_user', 'test')\n#2
var/www/html/testlink/lib/functions/doAuthorize.php(90):
auth_does_password_match(Object(tlUser), 'test')\n#3
var/www/html/testlink/login.php(45): doAuthorize(Object(database),
'test_user', 'test', Object(stdClass))\n#4 {main}\n thrown in
var/www/html/testlink/lib/functions/ldap_api.php on line 42, refer:
http://***.**.com/login.php
How can I configure ldap?
Upvotes: 4
Views: 8250
Reputation: 71
You need to put the following lines in your php Dockerfile
RUN apt-get update && apt-get install -y \
libldap2-dev
RUN docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/
RUN docker-php-ext-install ldap
Upvotes: 7
Reputation: 3861
YourApache/PHP container is missing the PHP LDAP extension. You will need to either rebuild that container so that it includes the PHP LDAP extension or you need to use a Userland LDAP-library like https://packagist.org/packages/freedsx/LDAP (never used it so can't say anything about it). Beware that the Userland library uses a different API than the PHP extension, so you will need to rewrite your code. So in the end rebuilding your container can be the easier solution.
Upvotes: 0