|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14355 ldap_connect works intermittantly
Submitted: 2001-12-05 18:58 UTC Modified: 2002-07-31 01:00 UTC
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: liamr at umich dot edu Assigned:
Status: No Feedback Package: LDAP related
PHP Version: 4.0.6 OS: Solaris 2.6 (SPARC)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: liamr at umich dot edu
New email:
PHP Version: OS:


 [2001-12-05 18:58 UTC] liamr at umich dot edu
server config - Sun Ultra 2 (dual 300mhz IIs), 768MB RAM, 
Solaris 2.6 (SPARC), Apache 1.3.20, PHP 4.0.6 (and 4.0CVS-
12-0-4) configured as DSOs.

I'm trying to build PHP as an apache module w/ support for 
LDAP (for use w/ HORDE).  PHP builds fine, and apxs is able 
to make the .so file, but I regularly get "Unable to 
connect to LDAP server".  Apache doesn't segfault, and 
phpinfo() shows that LDAP support has been built in.  There 
is no mention of it in my php error log, nor my apache 
error log.

My build was fairly complex (including support Oracie 8i, 
which I disabled when I found the OpenLDAP / OCI8 / Solaris 
threads in the bugs database).  I've tried building against 
OpenLDAP 1.2.12, 1.2.13, 2.0.18 and the Oracle LDAP library 
that ships w/ 8.1.17 (when I added --with-oci8).  The most 
basic configuration line looks like:

env CC="gcc" \
CFLAGS="-I/usr/local/openldap/include" \
CPPFLAGS="-I/usr/local/openldap/include" \
CXXFLAGS="-I/usr/local/openldap/include" \
./configure --with-apxs=/usr/local/apache/bin/apxs \

I make distclean between re-configure and re-builds.

I've tried gcc 2.95.2, 2.95.3, and the Sun Workshop (4.2) 
version cc.  I've had no problem with PHP+LDAP when built 
as the CGI.  The DSO has been very flakey.  I've not tried 
building PHP directly into Apache. If the DSO works, it 
works until the apache is restarted.  I've not kept track, 
but I'd say at least 75% of the time after apache is 
restarted (or stopped and started), LDAP doesn't work - and 
this behavior is consistant with the various LDAP libraries 
I've tried.

I wish I could provide more information - is there 
additional debugging I can turn on, or maybe add to the C 

thanks much


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-12-06 01:19 UTC] liamr at umich dot edu
I just watched the wire w/ tcpdump - there's no 
communication between the webserver and the LDAP server.
 [2001-12-10 01:17 UTC] liamr at umich dot edu
tried it with php built into apache statically.  same 
 [2001-12-23 11:41 UTC]
I'm sorry, I don't have any solutions for you. I guess
no one else does either.

First of all, have you tried to supply an IP address, so that we can be sure it's not DNS related? Did you try to build with the Oracle 8i LDAP? You can do that with something like --with-ldap=/usr/local/oracle/product/8.1.6
It would be interesting to know whether the problem was
still there.

If you use OpenLDAP 2.x and very latest PHP snapshot, you
can get debugging output by doing
ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
at the beginning of your script. Last parameter is a bit
mask. If you don't want to use latest PHP, the easiest is to add something like
int debug = 7;
ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &debug);
inside PHP's ldap_connect(). You could also try to add some debugging code in the OpenLDAP library (or use gdb or something). I would then try to add a printf() to the
beginning of ldap_init() in libldap/open.c
 [2002-01-09 09:58 UTC] liamr at umich dot edu
It looks like ORACLE_HOME needs to be set in order for the Oracle LDAP client to work, which is odd because I rarely need to set it to get the database client working.  From what I've seen, LDAP works consistantly if I set ORACLE_HOME in the webserver's startup scripts.

I don't know why the openldap stuff wasn't working.  I guess the point is moot until I *have* to use openldap (which probably won't happen unless the PHP LDAP code learns how to bind w/ kerberos).
 [2002-06-29 20:09 UTC]
Please try this snapshot:

 [2002-07-31 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 06:01:30 2024 UTC