ID:               32834
 Updated by:       [EMAIL PROTECTED]
 Reported By:      justo dot alonso at gmail dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         LDAP related
 Operating System: Linux (Suse 8.2)
 PHP Version:      4.3.11
 New Comment:

Get the latest snapshot here: 

  http://snaps.php.net/php4-STABLE-latest.tar.gz

And compile that with this configure line: (And EXACTLY THIS!)

# ./configure --disable-all --with-ldap --with-apxs2 --enable-debug
# make 

The one you pasted here is definately NOT the one
used to configure the libphp4.so you have since that one
will only build CGI binary. And that one is also trying to outsmart the
PHP configure -> not supported!



Previous Comments:
------------------------------------------------------------------------

[2005-04-26 12:22:38] justo dot alonso at gmail dot com

Description:
------------
I have an Apache 2.0.54 server with mod_ldap and mod_auth_ldap modules
loaded. The PHP is a module of Apache. When I use the code below, the
first 2 times it works, but the third, the apache server process
hangs.

I've tried it with Apache 1.3.27 and hungs, too. It seems like there's
some kind of conflict between mod_ldap and the php module, because when
I disable mod_ldap all works fine.

Openldap library: openldap2-client-2.1.12-44 (Suse release)
PHP config.nice file:

CFLAGS='-O2 -march=i486 -mcpu=i686 -fPIC -DHAVE_LIBDL=1
-I/usr/include/ucd-snmp -I/usr/lib/SunJava2-1.4/include
-I/usr/lib/SunJava2-1.4/include/linux' \
'./configure' \
'--prefix=/usr/share' \
'--datadir=/usr/share/php' \
'--bindir=/usr/bin' \
'--libdir=/usr/share' \
'--includedir=/usr/include' \
'--with-_lib=lib' \
'--with-config-file-path=/etc' \
'--with-exec-dir=/usr/lib/php/bin' \
'--disable-debug' \
'--enable-bcmath' \
'--enable-calendar' \
'--enable-ctype' \
'--enable-dbase' \
'--enable-discard-path' \
'--enable-exif' \
'--enable-filepro' \
'--enable-force-cgi-redirect' \
'--enable-ftp' \
'--enable-gd-imgstrttf' \
'--enable-gd-native-ttf' \
'--enable-inline-optimization' \
'--enable-magic-quotes' \
'--enable-mbstr-enc-trans' \
'--enable-mbstring' \
'--enable-mbregex' \
'--enable-memory-limit' \
'--enable-safe-mode' \
'--enable-shmop' \
'--enable-sigchild' \
'--enable-sysvsem' \
'--enable-sysvshm' \
'--enable-track-vars' \
'--enable-trans-sid' \
'--enable-versioning' \
'--enable-wddx' \
'--enable-yp' \
'--with-bz2' \
'--with-dom=/usr/include/libxml2' \
'--with-ftp' \
'--with-gdbm' \
'--with-gettext' \
'--with-gmp' \
'--with-imap=yes' \
'--with-jpeg-dir=/usr' \
'--with-ldap=yes' \
'--with-mcal=/usr' \
'--with-mcrypt' \
'--with-mysql=/usr' \
'--with-ndbm' \
'--with-png-dir=/usr' \
'--with-readline' \
'--with-snmp' \
'--with-t1lib' \
'--with-tiff-dir=/usr' \
'--with-ttf' \
'--with-freetype-dir=yes' \
'--with-xml' \
'--with-xpm-dir=/usr/X11R6' \
'--with-zlib=yes' \
'--with-qtdom=/usr/lib/qt3' \
'--with-gd' \
'--with-openssl=/usr' \
'--with-imap-ssl' \
'--enable-xslt' \
'--with-xslt-sablot' \
'--with-iconv' \
'--with-mm' \
'i386-suse-linux' \
"$@"




Reproduce code:
---------------
<?php
echo "<!-- before connect to LDAP -->\n";
$conn = ldap_connect( $LDAP_ACTIVE_SERVER );
if ($conn) {
  if( ldap_set_option($conn, LDAP_OPT_PROTOCOL_VERSION, 3)
      && ldap_set_option($conn, LDAP_OPT_DEREF, 0) 
      && ldap_set_option($conn,LDAP_OPT_REFERRALS,FALSE)) {
      if( ($r = ldap_bind($conn, $LDAP_ACTIVE_BINDDN,
           $LDAP_ACTIVE_BINDPA )) ) {
         echo "<!-- before the search -->\n";
         flush();

         $sr = ldap_search($conn, $LDAP_ACTIVE_BASEDN,
               $LDAP_ACTIVE_FILTER, $LDAP_ACTIVE_ATTRIB, 
               0, 2, 5, LDAP_DEREF_NEVER );

         if( ldap_count_entries($conn, $sr) == 1 ) {
             $entry = ldap_first_entry( $conn, $sr );
             $dn = ldap_get_dn( $conn, $entry );

             echo "<!-- the DN: $dn -->\n";
             flush();

             if( $dn ) {
                 $auth = ldap_bind( $conn,$dn, 
                         $_SERVER["PHP_AUTH_PW"] );

                 if( $auth ) {
                     $is_ok = 1;
                     echo "<!-- bind success -->\n";
                     flush();
                  }
              }
         }
         ldap_free_result( $sr );
      }
  } else {
     echo "<!-- unable to set options -->\n";
  }
  ldap_close($conn);
}
?>


Expected result:
----------------
HTTP/1.1 200 OK
Date: Tue, 26 Apr 2005 09:15:35 GMT
Server: Apache
X-Powered-By: PHP/4.3.11
Transfer-Encoding: chunked
Content-Type: text/html; charset=ISO-8859-1
Content-Language: es

<!-- before connect to LDAP -->
<!-- before the search -->
<!-- the DN: CN=Justo Alonso  Achaques -->
<!-- bind success -->


Actual result:
--------------
A backtrace with gdb, with a ctrl-C because the server don't crash

#0  0x4026df0d in malloc_consolidate () from /lib/libc.so.6
#1  0x4026da93 in _int_malloc () from /lib/libc.so.6
#2  0x4026c898 in malloc () from /lib/libc.so.6
#3  0x4071b177 in _emalloc () from /usr/lib/apache2-prefork/libphp4.so
#4  0x4071b824 in _estrndup () from
/usr/lib/apache2-prefork/libphp4.so
#5  0x40707233 in php_register_variable_safe () from
/usr/lib/apache2-prefork/libphp4.so
#6  0x407071ac in php_register_variable () from
/usr/lib/apache2-prefork/libphp4.so
#7  0x40707b36 in _php_import_environment_variables () from
/usr/lib/apache2-prefork/libphp4.so
#8  0x406fd03f in php_hash_environment () from
/usr/lib/apache2-prefork/libphp4.so
#9  0x406fbb7a in php_request_startup () from
/usr/lib/apache2-prefork/libphp4.so
#10 0x40740e01 in php_apache_request_ctor () from
/usr/lib/apache2-prefork/libphp4.so
#11 0x4074146d in php_handler () from
/usr/lib/apache2-prefork/libphp4.so
#12 0x08069d38 in ap_run_handler ()
#13 0x0806a449 in ap_invoke_handler ()
#14 0x080665da in ap_process_request ()
#15 0x0806100e in _start ()
#16 0x080753d8 in ap_run_process_connection ()
#17 0x080757be in ap_process_connection ()
#18 0x08067ff4 in ap_graceful_stop_signalled ()
#19 0x080681a2 in ap_graceful_stop_signalled ()
#20 0x080682bc in ap_graceful_stop_signalled ()
#21 0x08068b1d in ap_mpm_run ()
#22 0x0806feaf in main ()
#23 0x4020b8ae in __libc_start_main () from /lib/libc.so.6



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=32834&edit=1

Reply via email to