php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6650 ldap_add() working in PHP3, broken in PHP4
Submitted: 2000-09-10 15:56 UTC Modified: 2000-10-29 00:11 UTC
From: tengel at fluid dot com Assigned: sniper (profile)
Status: Closed Package: LDAP related
PHP Version: 4.0.2 OS: Solaris 2.7
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: tengel at fluid dot com
New email:
PHP Version: OS:

 

 [2000-09-10 15:56 UTC] tengel at fluid dot com
Solaris 2.7, BerkelyDB 2.7.7, OpenLDAP 1.2.11, Apache 1.3.12.  A test script (below) when run with PHP4 (4.0.2) fails with a "Document contains no data"; it works perfectly fine in PHP3 (3.0.16).  Nothing is changed, simply change the Apache config file to enable 3 or 4 and test:

<?php
  $SERVER = "localhost";
  $ROOTDN = "cn=manager, dc=fluid, dc=com";
  $ROOTPW = "[MY SECRET PASSWORD]";
  $ldap=ldap_connect($SERVER);
  if($ldap) {
    if(ldap_bind($ldap, $ROOTDN, $ROOTPW)) {
      $entry["uid"]="tuser";
      $entry["cn"]="Test User";
      $entry["sn"]="User";
      $entry["objectClass"]="person";
      $dn="uid=tuser, ou=Employees, dc=fluid, dc=com";
      if(ldap_add($ldap, $dn, $entry)) {
        print("<H3>Entry Added!</H3>");
      } else {
        print("<H3>Add Failed!</H3>");
        $error=ldap_error($ldap);
        print("<BR>($error)");
      }
      print("</body></html>");
    }
    @ldap_close($ldap);
  } else {
    print("Connection Failed!");
    $error=ldap_error($ldap);
    print("<BR>($error)");
  }
?>

Configuration params for all tools:

BerkleyDB 2.7.7:
../dist/configure

OpenLDAP 1.2.11:
env \
  ac_cv_func_pthread_create=no ol_cv_kthread_flag=no \
  ol_cv_pthread_flag=no ol_cv_pthreads_flag=no \
  ol_cv_thread_flag=no \
  CPPFLAGS="-I/usr/local/BerkeleyDB/include" \
  LDFLAGS="-L/usr/local/BerkeleyDB/lib" \
  ./configure --with-ldbm-api=db2

Apache 1.3.12:
./configure \
  --with-layout=Apache \
  --prefix=/usr/local/dbdev/apache \
  --enable-module=most \
  --enable-shared=max

PHP 4.0.2
./configure \
  --enable-ftp \
  --disable-short-tags \
  --with-ldap=/usr/local \
  --with-apxs=/usr/local/dbdev/apache/bin/apxs \
  --with-oci8=/u01/app/oracle/product/8.1.6 \
  --with-exec-dir=/usr/local/dbdev/php/bin \
  --with-config-file-path=/usr/local/dbdev/php/lib \
  --with-db2=/usr/local/BerkeleyDB

The php.ini file used is the default php.ini-dist, it's never been touched.

-- 
Troy Engel
tengel@fluid.com

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-09-10 18:27 UTC] venaas@php.net
I can't tell you exactly why it happens with PHP 4 and not 3, but I
think this is because Oracle 8.1.6 has an LDAP library conflicting
with the OpenLDAP one. You may want to try using the Oracle
library instead, simply use
--with-ldap=/u01/app/oracle/product/8.1.6

 [2000-09-11 15:02 UTC] tengel at fluid dot com
Yes!  That worked (--with-ldap=/u01/app/oracle/product/8.1.6), it is now behaving normally.  Doing a "ldd" on libphp3.so and libphp4.so show that they're linked to different parts of my Oracle installation, so something changed in the linker chain in PHP4 to introduce this problem.

So, is this still considered a bug, or is it just one of those things for the FAQ/Knowledgebase?  It *seems* like I should be able to specify an alternate LDAP while compiling Oracle - I personally want to compile/link against OpenLDAP, as I plan on upgrading to the 2.0 release.

 [2000-10-29 00:11 UTC] sniper@php.net
Fixed in CVS now.

--Jani
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 09 02:01:27 2024 UTC