Page 1 of 1
LDAP easy question
Posted: Thu Aug 30, 2007 1:34 am
by AP81
Hi guys,
Hopefully someone will be able to point me in the right direction with this.
I have developed an Intranet for my company which is powered by a LAMP server. I have been asked to authenticate users against our domain controller ($MS), so I don't have to maintain a different user logon/password for Windows and the Intranet. Users also need to be able to logon from outside the company using there user name and password.
My first thought was to use LDAP which looks seems very easy from the PHP side of things. The problem I have having is getting LDAP working as I have found too many different solutions to doing this.
What do I actually need to do this? I have installed the php5-ldap (LAMP server is a Ubuntu box). Is this sufficient or do I need to install an ldap client on this box too?
I am starting to think that a radius server is easier ...
Posted: Thu Aug 30, 2007 1:50 am
by AP81
Edit: Is this sufficient or do I need to install an ldap server on this box too?
Posted: Thu Aug 30, 2007 5:13 am
by volka
according to
http://archive.ubuntu.com/ubuntu/dists/ ... ackages.gz there is a package php5-ldap containing the ldap extension module for php 5 in feisty's main repository.
http://archive.ubuntu.com/ubuntu/dists/feisty/main/binary-i386/Packages.gz wrote:Package: php5-ldap
Priority: optional
Section: web
Installed-Size: 96
Maintainer: Ubuntu Core Developers <
ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian PHP Maintainers <
pkg-php-maint@lists.alioth.debian.org>
Architecture: i386
Source: php5
Version: 5.2.1-0ubuntu1
Depends: libc6 (>= 2.5-0ubuntu1), libldap2 (>= 2.1.17-1), phpapi-20060613+lfs, php5-common (= 5.2.1-0ubuntu1)
Filename: pool/main/p/php5/php5-ldap_5.2.1-0ubuntu1_i386.deb
Size: 17358
MD5sum: fdb082c4cb207d5fd103f3174b29a626
SHA1: ca74de8333ded192a302a240833b1babd2e6707d
SHA256: 6b86135b0724315e8913d5cfe829fa8574f370e83f3f37f0bf1a3e81713a664c
Description: LDAP module for php5
This package provides a module for LDAP functions in PHP scripts.
.
PHP5 is an HTML-embedded scripting language. Much of its syntax is borrowed
from C, Java and Perl with a couple of unique PHP-specific features thrown
in. The goal of the language is to allow web developers to write
dynamically generated pages quickly.
Bugs: mailto:
ubuntu-users@lists.ubuntu.com
Origin: Ubuntu
Posted: Thu Aug 30, 2007 5:53 am
by AP81
Hi Volka,
Thanks, I have already installed the package. The ldap.so extension is already enabled in php.ini, but ldap doesn't show in in phpinfo().
A lot of pages I read were talking about using openLDAP to authenticate, hence why it threw me off.
I that is all I need I'll give it another go.
Thanks,
Adam
Posted: Thu Aug 30, 2007 6:31 am
by volka
Did you restart the apache after installing the module?
Posted: Thu Aug 30, 2007 9:57 am
by pickle
I'm pretty sure you need to install the openLDAP package as well.
Posted: Thu Aug 30, 2007 10:37 am
by Kieran Huggins
I thought I'd replied to this, but it seems my post was lost.
You need to install the PECL module, an LDAP client *AND* compile PHP with LDAP support. There are instructions with links to a few free clients on the LDAP manual page. I wish there were a better way, but alas...
Posted: Thu Aug 30, 2007 5:56 pm
by AP81
Thanks kieran,
At least I have some direction now.
It's just one of those things that has a lot of conflicting documentation.
Posted: Thu Aug 30, 2007 7:23 pm
by volka
Wouldn't Ubuntu's package manager take care of such dependencies?
Posted: Fri Aug 31, 2007 12:08 am
by AP81
Got it working...
My original attempt was correct (apt-get install php5-ldap). Ubuntu place the ldap.so libaray in the wrong place (non the correct extensions dir). After moving this library, phpinfo showed LDAP working and it is working fine.
Now to get SSL working ...
So Volka, yes you were right: Wouldn't Ubuntu's package manager take care of such dependencies?
Thanks all.
Posted: Fri Aug 31, 2007 5:59 am
by volka
AP81 wrote:Ubuntu place the ldap.so libaray in the wrong place (non the correct extensions dir).
Strange. Have you installed all of the packages involved via yum/synaptics? If so you might want to report a bug to ubuntu.
If you have installed anything "manually", e.g. by compiling from sources without using ubuntu's build system, it is possible you now have two sets of default paths on your system

Posted: Sun Sep 02, 2007 6:02 pm
by AP81
Hi Volka,
Nothing has been compiled by source. I installed everything via apt, but I noticed that apt created two separate extension dirs, one was:
/usr/lib/php5/20051025/ and the other /usr/lib/php5/ext/. Both of these also had the same library files in there.
By default, apache was using the /usr/lib/php5/20051025/ directory, so I changed the extension dir in php.ini to use ext instead, following the standard naming convention. I did this some time ago (a few months), and had forgotten about it.
So an apt-get install php5-ldap put it in the 20051025 which was my problem.
Thanks,
Adam