Data Centers

How to install phpLDAPadmin on Ubuntu 18.04

If you're looking to install phpLDAPadmin on Ubuntu 18.04, but have run into deprecation errors, Jack Wallen offers a solution.

datahero.jpg
Image: Jack Wallen

Recently we walked through the process of installing and using OpenLDAP on Ubuntu 18.04. That process isn't terribly difficult, but using OpenLDAP from the command line to enter LDAP data can be very cumbersome.

Fortunately, there are tools available to make this process considerably easier. One such tool is phpLDAPadmin. This particular web-based front-end for OpenLDAP makes creating entries into the LDAP database as easy as point and click.

And installing phpLDAPadmin is quite simple. Or at least it was. Prior to the release of Ubuntu 18.04, installing this tool was as easy as opening a terminal window and issuing the command:

sudo apt-get install phpldapadmin

SEE: Power checklist: Managing and troubleshooting Linux user accounts (Tech Pro Research)

However, there's a problem. With the latest release of Ubuntu Server, PHP was upgraded to 7.2. Because of this, there are a number of deprecation issues found in phpLDAPadmin, so installing from the standard repositories won't work. Thankfully, a developer took care of the issues plaguing the latest release of phpLDAPadmin and PHP 7.2 and made it possible to install this front-end.

I'm going to show you how to install the workaround, created by GitHub user breisig. It's quite easy to do and only requires you already have OpenLDAP installed and working on your Ubuntu Server 18.04 platform.

Requirements

Outside of having OpenLDAP running on your Ubuntu Server 18.04 platform, you will also need to install git. This is done with the command:

sudo apt-get install git

Once you have that requirement out of the way, you're ready to go.

Installing phpLDAPadmin

Back at the terminal window, change into the document root of your web server with the command cd /var/www/html. Next, clone phpLDAPadmin with the command:

sudo git clone https://github.com/breisig/phpLDAPadmin.git

To make things slightly easier, let's rename that directory with the command:

sudo mv /var/www/html/phpLDAPadmin /var/www/html/phpldapadmin

The final step in the installation is to copy the configuration file. Change into the config directory with the command cd /var/www/html/phpldapadmin/config and then copy the file with the command:

sudo cp config.php.example config.php

You could now point your browser to http://SERVER_IP/phpldapadmin and start using the tool. However, there's a couple of configuration options to be taken care of.

Configuration

Issue the command sudo nano /var/www/html/phpldapadmin/config/config.php. In this file you'll want to take care of the following configuration options:

To prevent any possible security issues with the phpLDAPadmin server address, change the following:

// $servers->setValue('server','host','127.0.0.1');

To:

$servers->setValue('server','host','SERVER_IP');

where SERVER_IP is the address of the OpenLDAP server.

The next configurations are as follows.

Around line 300, change the following:

$servers->setValue('server','base',array());

To:

$servers->setValue('server','base',array('dc=example,dc=com));

Note: You will change example and com to whatever domain you used in setting up OpenLDAP.

Go to (approximately) line 335 and change:

//$servers->setValue('server','tls',false);

To:

$servers->setValue('server','tls',false);

Around line 453, change the line:

//$servers->setValue('login','anon_bind',true);

To:

$servers->setValue('login','anon_bind',false);

That's all there is to the configuration options. Save and close the file.

Using phpLDAPadmin

You can now point your browser to http://SERVER_IP/phpldapadmin (where SERVER_IP is the IP address of your hosting server). You will see the login screen, at which point you will enter cn=admin,dc=example,dc=com as the username and the password you created when installing OpenLDAP. If you used a different domain than example.com, you would replace those entries in the username to fit your needs.

Once properly authenticated, you should see the phpLDAPadmin screen, where you can start entering data to your OpenLDAP server (Figure A).

Figure A

Figure A

Your phpLDAPadmin front-end is ready to serve.

Easy path to LDAP data entry

You now have a much easier path to LDAP data entry. Thanks to this handy fix for phpLDAPadmin, you are no longer bound to the command line for entering information on OpenLDAP with Ubuntu Server 18.04.

Also see

About Jack Wallen

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website jackwallen.com.

Editor's Picks

Free Newsletters, In your Inbox