ID:               15702
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Feedback
+Status:           Open
 Bug Type:         Java related
 Operating System: Red Hat Linux 7.1
 PHP Version:      4.1.1
 New Comment:

I have generated backtrace this time which showed that problem was
related 
to mutex.c. I used Apache 2.0 because there was also a problem in swf.c
which 
resulted in segmentation fault when using Apache 2 only not Apache
1.3.

After I removed --with-swf from configure Apache and php worked fine. I

have also submitted that bug report.

Then I decided to find the source of segmentation fault caused by Java

extension. 
This time I used --enable-debug configure option and Apache 2 beta 
(Apache 2_0_28) and compiled php 4.1.1 as Apache shared module 
(libphp4.so).
-
---------------------------APACHE 2_0_28--------------------------

./configure --prefix=/wwwroot --enable-auth-anon --enable-auth-db 
--enable-auth-dbm --enable-auth-digest --enable-file-cache
--enable-echo 
--enable-cache --enable-mem-cache --enable-example --enable-ext-filter

--enable-case-filter --enable-case-filter-in --enable-mime-magic 
--enable-cern-meta --enable-expires --enable-usertrack
--enable-unique-id 
--enable-ssl --enable-optional-hook-export
--enable-optional-hook-import 
--enable-optional-fn-import --enable-optional-fn-export --enable-http 
--enable-dav --enable-cgi --enable-info --enable-cgid --enable-dav-fs 
--enable-vhost-alias --enable-speling --enable-actions --enable-rewrite

--enable-so

 --------------------------PHP 4.1.1--------------------------------
  ./configure --prefix=/wwwroot/php --with-apxs2=/wwwroot/bin/apxs 
--with-mod_charset --with-config-file-path=/wwwroot/php/ --with-openssl

--with-zlib --enable-bcmath --with-bz2 --enable-calendar --with-cpdflib

--with-png-dir --with-jpeg-dir --with-tiff-dir --enable-ctype
--with-curl 
--with-db3 --with-dom --enable-exif --enable-filepro --enable-ftp
--with-gd 
--enable-gd-native-ttf --with-xpm-dir --with-freetype-dir=/usr
--with-ttf 
--with-t1lib --with-gettext --with-gmp --with-hyperwave --with-iconv 
--with-imap --with-kerberos --with-imap-ssl --with-ircg --with-ldap 
--enable-mbstring --enable-mbstr-enc-trans --with-mcal=/usr/src/libmcal

--with-mhash --with-mnogosearch=/usr/local/mnogosearch --with-mysql 
--with-pgsql --with-pspell --with-qtdom --enable-trans-sid
--enable-shmop 
--with-snmp -enable-ucd-snmp-hack --enable-sockets --with-regex=php 
--enable-wddx --with-expat-dir=/usr/local --enable-xslt
--with-xslt-sablot 
--with-yaz=/usr/local/lib --enable-yp --with-zip --with-pdflib 
--enable-versioning --with-tsrm-st --with-tsrm-pthreads 
--enable-track-vars --enable-overload --with-mcrypt
--with-Java=/usr/Java/j2sdk1.4.0 --enable-sysvsem --enable-sysvshm 
--enable-debug
------------------------------------------------------------------------
Apache and php worked well no segmentation fault etc. But Java didn't 
work. I had to stop Apache and export LD_LIBRARY_PATH as below:

export
LD_LIBRARY_PATH=/usr/Java/j2sdk1.4.0/jre/lib/i386/native_threads:/usr/java/j2sdk1.4.0/jre/lib/i386/client:/usr/java/j2sdk1.4.0/jre/lib/i386;


Then I started Apache using gdb.
$gdb /wwwroot/bin/httpd
(gdb)run -X

and accessed http://localhost/jver.php (test file supplied with Java
ext)

Browser waited for ever and gdb produced this:

--------------------------------------------------
Starting program: /wwwroot/bin/httpd -X
[New Thread 1024 (LWP 828)]
[New Thread 2049 (LWP 835)]
Delayed SIGSTOP caught for LWP 835.
[New Thread 1026 (LWP 836)]
Delayed SIGSTOP caught for LWP 836.
[New Thread 2051 (LWP 837)]
Delayed SIGSTOP caught for LWP 837.
[New Thread 3076 (LWP 838)]
Delayed SIGSTOP caught for LWP 838.
[New Thread 4101 (LWP 839)]
[New Thread 5126 (LWP 840)]
Delayed SIGSTOP caught for LWP 840.
[New Thread 6151 (LWP 841)]
Delayed SIGSTOP caught for LWP 841.
[New Thread 7176 (LWP 842)]
Delayed SIGSTOP caught for LWP 842.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 7176 (LWP 842)]
__pthread_mutex_lock (mutex=0x2a00040c) at mutex.c:99
99      mutex.c: No such file or directory.
        in mutex.c

backtrace produced this:

---------------------------------------------
(gdb) bt

#0  __pthread_mutex_lock (mutex=0x2a00040c) at mutex.c:99
#1  0x4033f7ac in __libc_free (mem=0x403e7490) at malloc.c:3052
#2  0x408953aa in Arena::dispose (this=0x82ad4b0) at arena.cpp:67
#3  0x408953f8 in Arena::~Arena (this=0x82ad4b0, __in_chrg=3) at 
arena.cpp:79
#4  0x4193ea87 in ciEnv::~ciEnv ()
   from /usr/Java/j2sdk1.4.0/jre/lib/i386/client/libjvm.so
#5  0x41953ea5 in CompileBroker::invoke_compiler_on_method ()
   from /usr/Java/j2sdk1.4.0/jre/lib/i386/client/libjvm.so
#6  0x419539c8 in CompileBroker::compiler_thread_loop ()
   from /usr/Java/j2sdk1.4.0/jre/lib/i386/client/libjvm.so
#7  0x4192197a in compiler_thread_entry ()
   from /usr/Java/j2sdk1.4.0/jre/lib/i386/client/libjvm.so
#8  0x4191e2fb in JavaThread::thread_main_inner ()
   from /usr/Java/j2sdk1.4.0/jre/lib/i386/client/libjvm.so
#9  0x4191e2a6 in JavaThread::run ()
   from /usr/Java/j2sdk1.4.0/jre/lib/i386/client/libjvm.so
#10 0x418e5799 in _start ()
   from /usr/Java/j2sdk1.4.0/jre/lib/i386/client/libjvm.so
#11 0x402b4078 in pthread_start_thread_event (arg=0xbebffc00) at 
manager.c:262
(gdb)


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

[2002-02-24 17:23:21] [EMAIL PROTECTED]

Can you please try to minimize the number of options you pass to PHPs
configure command and still have this error occur?  i.e. does it happen
when you use this as your configure command:

./configure --prefix=/wwwroot/php --with-apxs=/wwwroot/bin/apxs
--with-java=/usr/java/j2sdk1.4.0

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

[2002-02-24 17:02:50] [EMAIL PROTECTED]

Hello,
I tried to compile php with Java support and faced these problems. My
configuration is RedHat Linux 7.1, apache_1.3.23, php-4.1.1 and Jdk1.4
beta 2.

I must mention here that earlier php versions 4.0.6 (or earlier) and
jdk1.2.2 worked without any problems (and without exporting
LD_LIBRARY_PATH

With php 4.1.1 and jdk1.4, I faced many problems:

***************************************Results with Apache
1.3.23**********************

I first tried to compile php and apache with almost all options
available as below: 

/////////////////////////////////////PHP////////////////////////////////////

./configure --prefix=/wwwroot/php --with-apache=/usr/src/apache_1.3.23

--with-mod_charset --with-config-file-path=/wwwroot/php/ --with-openssl

--with-zlib --enable-bcmath --with-bz2 --enable-calendar --with-cpdflib

--with-png-dir --with-jpeg-dir --with-tiff-dir --enable-ctype
--with-curl 
--with-db3 --with-dom --enable-exif --enable-filepro --enable-ftp 
--with-gd --enable-gd-native-ttf --with-xpm-dir
--with-freetype-dir=/usr 
--with-ttf --with-t1lib --with-gettext --with-gmp --with-hyperwave 
--with-iconv --with-imap --with-kerberos --with-imap-ssl --with-ircg 
--with-ldap --enable-mbstring --enable-mbstr-enc-trans 
--with-mcal=/usr/src/libmcal --with-mhash
--with-mnogosearch=/usr/local/mnogosearch --with-mysql --with-pgsql
--with-pspell --with-qtdom --enable-trans-sid --enable-shmop
--with-snmp -enable-ucd-snmp-hack --enable-sockets --with-regex=php
--with-swf 
--enable-wddx --with-expat-dir=/usr/local --enable-xslt
--with-xslt-sablot 
--with-yaz=/usr/local/lib --enable-yp --with-zip --with-pdflib 
--enable-versioning --with-tsrm-st --with-tsrm-pthreads 
--enable-track-vars --enable-overload --with-mcrypt 
--with-java=/usr/java/j2sdk1.4.0 --enable-sysvsem --enable-sysvshm 
--with-xmlrpc

////////////////////////////////////////APACHE////////////////////////////////////

./configure --prefix=/wwwroot
--activate-module=src/modules/php4/libphp4.a --with-perl=/usr/bin/perl
--enable-module=auth_anon --enable-module=auth_dbm
--enable-module=auth_db --enable-module=auth_digest
--enable-module=cern_meta 
--enable-module=example --enable-module=expires --enable-module=headers
--enable-module=info --enable-module=log_agent
--enable-module=log_referer --enable-module=mime_magic
--enable-module=mmap_static --enable-module=proxy
--enable-module=rewrite --enable-module=so 
--enable-module=speling --enable-module=unique_id
--enable-module=usertrack --enable-module=vhost_alias
////////////////////////////////////////////////////////////////////////////////////

No libphp_java.so was created with these options under
/usr/src/php-4.1.1/modules or under /usr/src/php-4.1.1/ext/java and
only libphp_java.a was created. Under /wwwroot/php/lib/php/20010901
also only libphp_java.a was installed after make install.

Then thinking that java support might have been built in with this
version. I tried to access sample jver.php file. But message, unable to
create instance of non-existing class etc. was displayed.


Then I tried to compile php with only
--with-apache=/usr/src/apache_1.3.23 and
--with-java=/usr/java/j2sdk1.4.0 options and this time libphp_java.so
was created. But java didn't work (even after enabling [java] in
php.ini and exporting LD_LIBRARY_PATH as mentioned below).

I wanted to enable other php options so I deleted apache and php source
and install directories and tried to install php again as apache shared
module (libphp4.so) with following options

//////////////////////////////PHP////////////////////////////////////

./configure --prefix=/wwwroot/php --with-apxs=/wwwroot/bin/apxs 
--with-mod_charset --with-config-file-path=/wwwroot/php/ --with-openssl

--with-zlib --enable-bcmath --with-bz2 --enable-calendar --with-cpdflib

--with-png-dir --with-jpeg-dir --with-tiff-dir --enable-ctype
--with-curl 
--with-db3 --with-dom --enable-exif --enable-filepro --enable-ftp 
--with-gd --enable-gd-native-ttf --with-xpm-dir
--with-freetype-dir=/usr 
--with-ttf --with-t1lib --with-gettext --with-gmp --with-hyperwave 
--with-iconv --with-imap --with-kerberos --with-imap-ssl --with-ircg 
--with-ldap --enable-mbstring --enable-mbstr-enc-trans 
--with-mcal=/usr/src/libmcal --with-mhash 
--with-mnogosearch=/usr/local/mnogosearch --with-mysql --with-pgsql 
--with-pspell --with-qtdom --enable-trans-sid --enable-shmop
--with-snmp 
-enable-ucd-snmp-hack --enable-sockets --with-regex=php --with-swf 
--enable-wddx --with-expat-dir=/usr/local --enable-xslt
--with-xslt-sablot 
--with-yaz=/usr/local/lib --enable-yp --with-zip --with-pdflib 
--enable-versioning --with-tsrm-st --with-tsrm-pthreads 
--enable-track-vars --enable-overload --with-mcrypt 
--with-java=/usr/java/j2sdk1.4.0 --enable-sysvsem --enable-sysvshm 
--with-xmlrpc

///////////////////////////////////APACHE///////////////////////////////////////

./configure --prefix=/wwwroot --with-perl=/usr/bin/perl 
--enable-module=auth_anon --enable-module=auth_dbm
--enable-module=auth_db
--enable-module=auth_digest --enable-module=cern_meta 
--enable-module=example --enable-module=expires --enable-module=headers

--enable-module=info --enable-module=log_agent
--enable-module=log_referer 
--enable-module=mime_magic --enable-module=mmap_static 
--enable-module=proxy --enable-module=rewrite --enable-module=so 
--enable-module=speling --enable-module=unique_id 
--enable-module=usertrack --enable-module=vhost_alias

This time libphp_java.so was created and installed.

I enabled java support in php.ini as below:

[Java]
java.home=/usr/java/j2sdk1.4.0:/wwwroot/htdocs
java.class.path=/wwwroot/php/lib/php/php_java.jar
extension_dir=/wwwroot/php/lib/php/20010901
extension=libphp_java.so
java.library=/usr/java/j2sdk1.4.0/jre/lib/i386/client/libjvm.so

With above options libphp_java.so was shown as loaded by phpinfo().

When I tried to access that sample file provided with java extension
(jver.php) it produced error that libjvm.so was unable to load
libjava.so.

Then I exported LD_LIBRARY_PATH as:
export
LD_LIBRARY_PATH=/usr/java/j2sdk1.4.0/jre/lib/i386/native_threads:/usr/java/j2sdk1.4.0/jre/lib/i386:/usr/java/j2sdk1.4.0/jre/lib/i386/client;


Then I restarted apache from same shell in which I exported
LD_LIBRARY_PATH.
This time when I accessed jver.php browser sent the request and just
waited and waited and then exited with some message like network error
etc. I had enabled php error logging but nothing was entered in that
file. Then when I looked at apache error_log I found so segmentation
fault produced by php:

//////////////////////////////////////////////////////////////////////////////
[Sat Feb 23 20:51:09 2002] [notice] Digest: generating secret for
digest 
[Sat Feb 23 20:51:48 2002] [notice] child pid 704 exit 
signal Segmentation fault (11)
[Sat Feb 23 20:52:55 2002] [notice] child pid 703 exit 
signal Segmentation fault (11)
[Sat Feb 23 20:53:22 2002] [notice] child pid 706 exit 
signal Segmentation fault (11) // errors produced by php
authentication ...
/////////////////////////////////////////////////////////////////////////////////

Then I accessed jver.php again and these messages increased in apache
error_log. I knew these errors were due to some problem in php. But I
don't know what is the problem.

I changed java settings in php.ini as below but it still didn't work
and same error ("network error and segmentation fault in apache
error_log")

/////////////////////////////////////////////////////////
[Java]
java.home=/usr/java/j2sdk1.4.0:/wwwroot/htdocs
java.class.path=/wwwroot/php/lib/php/php_java.jar
extension_dir=/wwwroot/php/lib/php/20010901
extension=libphp_java.so
java.library=/usr/java/j2sdk1.4.0/jre/lib/i386/libjava.so // this was
changed
///////////////////////////////////////////////////////////////////////////////

------With JDK 1.2.2 it worked------------------------------------

Then thinking that there might be problem with Jdk1.4, I installed
Jdk1.3 and then Jdk1.2.2. With Jdk1.2.2 I compiled every thing again
from beginning and configure options changed to
--with-apache=/usr/src/apache_1.3.23 and --with-java changed according
to jdk1.2.2 paths. libphp_java.so was produced this time. When jver.php
was accessed this time errors were about unable to find libjvm.so and
other libs etc.
I exported LD_LIBRARY_PATH with paths of Jdk1.2.2 and restarted apache.
Finally this time it worked and Java Version was displayed.

I added this export to /root/.bashsrc and then to /etc/profile and
finally in /etc/httpd start function but this variable wasn't set and I
had to manually export LD_LIBRARY_PATH every time and then restart
apache only then java worked.

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


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

Reply via email to