User Tools

Site Tools


installing_phpldapadmin_on_ubuntu_18.04

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

installing_phpldapadmin_on_ubuntu_18.04 [2019/03/20 14:22] (current)
admin created
Line 1: Line 1:
 +====== Installing PHPLDAPadmin on Ubuntu 18.04 ======
  
 +First, install the package from the repository:
 +
 +  sudo apt install phpldapadmin
 +
 +For the moment (in March 2019), there are a few issues with phpldapadmin regarding deprecated functions in the version of PHP supplied with Ubuntu that phpldapadmin relies on, so we need to do a few tweaks to get things working as they should. ​ I'm following the instructions I found [[https://​bugs.debian.org/​cgi-bin/​bugreport.cgi?​bug=890127|here]] to fix it.
 +
 +  * /​usr/​share/​phpldapadmin/​lib/​functions.php - change line 54 to:
 +
 +  function my_autoload($className) {
 +
 +  * Add this code on line 777:
 +
 +  spl_autoload_register("​my_autoload"​);​
 +
 +
 +  * In /​usr/​share/​phpldapadmin/​lib/​functions.php,​ change line 1083 to
 +
 +  $CACHE[$sortby] = __create_function('​$a,​ $b',​$code);​
 +
 +  * Then insert this code after line 1091:
 +
 +<​code>​
 +  function __create_function($arg,​ $body) {
 +    static $cache = array();
 +    static $maxCacheSize = 64;
 +    static $sorter;
 +    if ($sorter === NULL) {
 +        $sorter = function($a,​ $b) {
 +            if ($a->​hits == $b->​hits) {
 +                return 0;
 +            }
 +            return ($a->​hits < $b->​hits) ? 1 : -1;
 +        };
 +    }
 +    $crc = crc32($arg . "​\\x00"​ . $body);
 +    if (isset($cache[$crc])) {
 +        ++$cache[$crc][1];​
 +        return $cache[$crc][0];​
 +    }
 +    if (sizeof($cache) >= $maxCacheSize) {
 +        uasort($cache,​ $sorter);
 +        array_pop($cache);​
 +    }
 +    $cache[$crc] = array($cb = eval('​return
 +  function('​.$arg.'​){'​.$body.'​};'​),​ 0);
 +    return $cb;
 +  }
 +</​code>​
 +
 +  * Setting up inside Apache is pretty straightforward,​ this is the config I used inside an nginx server block:
 +
 +<​code>​
 +location /​phpldapadmin {
 +        alias /​usr/​share/​phpldapadmin/​htdocs;​
 +        index index.php index.html index.htm;
 +}
 +location ~ ^/​phpldapadmin/​.*\.php$ {
 +        root /usr/share;
 +        if ($request_filename !~* htdocs) {
 +                rewrite ^/​phpldapadmin(/​.*)?​$ /​phpldapadmin/​htdocs$1;​
 +        }
 +        fastcgi_pass unix:/​var/​run/​php/​php7.2-fpm.sock;​
 +        fastcgi_index index.php;
 +        fastcgi_param SCRIPT_FILENAME $request_filename;​
 +        include fastcgi_params;​
 +}
 +</​code>​
installing_phpldapadmin_on_ubuntu_18.04.txt ยท Last modified: 2019/03/20 14:22 by admin