php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15702 Segmentation fault (using jdk1.4 with php 4.2.3)
Submitted: 2002-02-24 17:02 UTC Modified: 2002-12-05 09:06 UTC
Votes:7
Avg. Score:4.0 ± 0.9
Reproduced:7 of 7 (100.0%)
Same Version:1 (14.3%)
Same OS:1 (14.3%)
From: ssruprai at hotmail dot com Assigned:
Status: Closed Package: Java related
PHP Version: 4.2.3 OS: Red Hat Linux 7.1
Private report: No CVE-ID:
 [2002-02-24 17:02 UTC] ssruprai at hotmail dot com
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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-24 17:23 UTC] elixer@php.net
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-03-08 14:48 UTC] sukhruprai at yahoo dot com
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)
 [2002-05-01 19:54 UTC] sukhruprai at yahoo dot com
I tried --with-java this time with php-4.2.0 and apache/2.0.35 (Unix) 
mod_ssl/2.0.35 OpenSSL/0.9.6 DAV/2 but instead of producing errors this time when sample file php jver.php is accessed page returned contains only single line "<HTML>" and response is http 1.1 ok. Other configuration were same as before.

----------
CONFIGURE
----------
 ./configure --with-apxs2=/wwwroot/bin/apxs --prefix=/wwwroot/php 
--with-config-file-path=/wwwroot/php --enable-bcmath --enable-calendar 
--enable-dbase --enable-dbx --enable-dio --enable-exif --enable-filepro 
--enable-ftp --enable-gd-native-ttf --enable-mbstring 
--enable-mbstr-enc-trans --enable--mbregex --enable-overload 
--enable-shmop --enable-ucd-snmp-hack --enable-sockets --enable-aggregate 
--enable-sysvsem --enable-sysvshm --enable-tokenizer --enable-wddx 
--enable-xslt --enable-yp --enable-versioning --with-mod-charset 
--with-openssl --with-zlib-dir --with-zlib --with-bz2 --with-cpdflib 
--with-jpeg-dir --with-tiff-dir --with-curl --with-db --with-db3 
--with-dom --with-dom-xslt --with-dom-exslt --with-gd --with-png-dir 
--with-xpm-dir --with-freetype-dir --with-ttf --with-t1lib --with-gettext 
--with-gmp --with-hyperwave --with-imap --with-kerberos --with-imap-ssl 
--with-ircg --with-ircg-config=/usr/local/bin/ircg-config --with-java 
--with-ldap --with-mcal=/usr/src/libmcal --with-mcrypt --with-mhash 
--with-ming --with-mnogosearch=/usr/local/mnogosearch --with-mysql 
--with-pdflib --with-pgsql --with-pspell --with-qtdom --with-snmp 
--with-regex=php --with-xmlrpc --with-xslt-sablot --with-sablot-js 
--with-yaz=/usr/local/lib --with-zip --with-iconv --enable-track-vars 
--enable-trans-sid --enable-debug

No error nothing is displayed. I have enabled php error logging also. But 
no error message added to this file.
When I used gdb then only I was able to know that it was unable to find 
libjvm.so

(gdb)
(gdb) run -X
Starting program: /wwwroot/bin/httpd -X
[New Thread 1024 (LWP 788)]
Error occurred during initialization of VM
Unable to load native library: libjvm.so: cannot load shared object file: 
No such file or directory

After I exported these java libraries path and again ran gdb response returned was http 1.1 ok But gdb produced this:

(gdb) run -X
Starting program: /wwwroot/bin/httpd -X
[New Thread 1024 (LWP 842)]
[New Thread 2049 (LWP 848)]
Delayed SIGSTOP caught for LWP 848.
[New Thread 1026 (LWP 849)]
Delayed SIGSTOP caught for LWP 849.
[New Thread 2051 (LWP 850)]
Delayed SIGSTOP caught for LWP 850.
[New Thread 3076 (LWP 851)]
Delayed SIGSTOP caught for LWP 851.
[New Thread 4101 (LWP 852)]
[New Thread 5126 (LWP 853)]
Delayed SIGSTOP caught for LWP 853.
[New Thread 6151 (LWP 854)]
Delayed SIGSTOP caught for LWP 854.
[New Thread 7176 (LWP 855)]
Delayed SIGSTOP caught for LWP 855.

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

------------------
BACKTRACE
------------------

(gdb) bt
#0  __pthread_mutex_lock (mutex=0x400040e) at mutex.c:99
#1  0x403d17ac in __libc_free (mem=0x40479490) at malloc.c:3052
#2  0x409063aa in Arena::dispose (this=0x8313220) at arena.cpp:67
#3  0x409063f8 in Arena::~Arena (this=0x8313220, __in_chrg=3) at 
arena.cpp:79
#4  0x41a36a87 in ciEnv::~ciEnv ()
   from /usr/java/j2sdk1.4.0/jre/lib/i386/client/libjvm.so
#5  0x41a4bea5 in CompileBroker::invoke_compiler_on_method ()
   from /usr/java/j2sdk1.4.0/jre/lib/i386/client/libjvm.so
#6  0x41a4b9c8 in CompileBroker::compiler_thread_loop ()
   from /usr/java/j2sdk1.4.0/jre/lib/i386/client/libjvm.so
#7  0x41a1997a in compiler_thread_entry ()
   from /usr/java/j2sdk1.4.0/jre/lib/i386/client/libjvm.so
#8  0x41a162fb in JavaThread::thread_main_inner ()
   from /usr/java/j2sdk1.4.0/jre/lib/i386/client/libjvm.so
#9  0x41a162a6 in JavaThread::run ()
   from /usr/java/j2sdk1.4.0/jre/lib/i386/client/libjvm.so
#10 0x419dd799 in _start ()
   from /usr/java/j2sdk1.4.0/jre/lib/i386/client/libjvm.so
#11 0x40346078 in pthread_start_thread_event (arg=0xbebffc00) at 
manager.c:262
 [2002-08-08 10:14 UTC] kalowsky@php.net
1) Can you please try not using Apache2, it's support is not stable with PHP.

2) Does this happen with the PHP 4.2.x and Apache1.XX releases?

3) Can you please please please please please please please please try making your configure script the bare minimum for these tests?  It helps us to determine where things are going wrong.  
 [2002-09-09 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".
 [2002-10-15 11:24 UTC] sukhruprai at yahoo dot com
I think you have not read it properly. My first comment was related apache 1.3.23 Yes this happens with all versions of apache only when using any jdk other later than 1.2.2.
 [2002-10-15 22:38 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip


And use MINIMUM amount of configure options when you test it.

 [2002-10-31 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over 2 weeks, 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".
 [2002-11-02 17:42 UTC] sukhruprai at yahoo dot com
I used php 4.2.3 this time with apache 2.0.43

Apache
------
./configure --prefix=/wwwroot --enable-so

php
----
/configure --prefix=/wwwroot/php --with-apxs2=/wwwroot/bin/apxs --with-java --with-mysql --with-config-file-path=/wwwroot/php

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

php.ini Setting
---------------
[Java]

java.class.path = /wwwroot/php/lib/php/php_java.jar
extension=java.so
java.home = /usr/java/j2sdk1.4.0
java.library = /usr/java/j2sdk1.4.0/jre/lib/i386/libjava.so
;java.library = /usr/java/j2sdk1.4.0/jre/lib/i386/client/libjvm.so
;java.library.path = /usr/java/j2sdk1.4.0/jre/lib/i386/client


Apache Start
------------
$ export LD_LIBRARY_PATH=/usr/java/j2sdk1.4.0/jre/lib/i386:/usr/java/j2sdk1.4.0/jre/lib/i386/client
$ /wwwroot/bin/apachectl start


Fatal error: java.lang.UnsatisfiedLinkError: no php_java in java.library.path in /wwwroot/htdocs/jver.php on line 4

Then I changed java setting in php.ini like this:

[Java]
java.class.path = /wwwroot/php/lib/php/php_java.jar
extension=java.so
java.library.path = /wwwroot/php/lib/php


But same error was displayed.

Fatal error: java.lang.UnsatisfiedLinkError: no php_java in java.library.path in /wwwroot/htdocs/jver.php on line 4

I also want to know what has to be specified in java.library.path?
In php.ini I also tried to use java.library.path=/usr/java/j2sdk1.4.0/jre/lib/i386:/usr/java/j2sdk1.4.0/jre/lib/i386/client

But it was unable to find other java libraries and this error was displayed:

Fatal error: Unable to load Java Library /usr/java/j2sdk1.4.0/./jre/lib/i386/libjava.so, error: libverify.so: cannot load shared object file: No such file or
directory in /wwwroot/htdocs/jver.php on line 4

So I had to mannual export LD_LIBRARY_PATH as above and then it displayed the
unsatisfied link error.
 [2002-11-05 18:24 UTC] ssruprai at hotmail dot com
Just wanted to change email so that I recevie the notification whenever this page is updated.
 [2002-11-05 19:09 UTC] kalowsky@php.net
I believe the current answer to this is to make a link to the library like so:

$extensiondir$/java.so to $extensiondir$/libphp_java.so

You can find more about this in Bug #19327

Does this solve the problem?  I know it's a hack at the moment, but the other bug details some of the issues with possible solutions.
 [2002-11-11 09:41 UTC] ssruprai at hotmail dot com
As you suggested above changing the extension=php_java.so without creating a symbolic link doesn't even load the extension.

So I tried it by creating a symbolic link to /wwwroot/php/lib/php/extensions/no-debug-zts-20020429/java.so as /wwwroot/php/lib/php/extensions/no-debug-zts-20020429/php_java.so and used the following setting in php.ini:

[Java]
extension_dir = /wwwroot/php/lib/php/extensions/no-debug-zts-20020429
java.class.path = /wwwroot/php/lib/php/php_java.jar
extension=php_java.so
;java.home = /usr/java/j2sdk1.4.0
;java.library = /usr/java/j2sdk1.4.0/jre/lib/i386/client/libjvm.so
;java.library = /usr/java/j2sdk1.4.0/jre/lib/i386/libjava.so
java.library.path = /wwwroot/php/lib/php/extensions/no-debug-zts-20020429


PHP loaded the java extension but it still displayed:

Fatal error: java.lang.UnsatisfiedLinkError: no php_java in java.library.path in /wwwroot/htdocs/jver.php on line 4

I don't know what it isn't able to find php_java.jar or php_java.so? PHP is able to find java.so thats why it loads the extension.

I also want to know what is the purpose of java.library.path? What should be specified here?

Does it work for you or others who use Sun jdk 1.4?

If yes then please try to update the README file in ext/java directory with settings which use Jdk 1.3 or 1.4 and which work on your own systems? Because not many these days use jdk 1.2.2.

I must mention that java extension on windows works without any problem even when using jdk1.4.
 [2002-11-28 07:08 UTC] chregu@php.net
first. you have to make a symlink from to
libphp_java.so not php_java.so...

second. sablotron < 0.97 and jdk >= 1.3 does not work together. Sablotron 0.97 is not out yet, but there is an RC1 in their CVS (didn't find a link to download it), which should solve the problem..

chregu
 [2002-12-03 09:22 UTC] ssruprai at hotmail dot com
http://bugs.php.net/bug.php?id=15702&edit=2 is not accepting my password. I don't know why so I am posting this as  comment

I think above you meant from java.so to libphp_java.so.
Yes I did create a symbolic link libphp_java.so to java.so. It again resulted inSegmentation fault. Here is the gdb output.


# export LD_LIBRARY_PATH=/usr/java/j2sdk1.4.0/jre/lib/i386:/usr/java/j2sdk1.4.0/jre/lib/i386/client

# gdb /wwwroot/bin/httpd 
GNU gdb 5.0rh-5 Red Hat Linux 7.1
Copyright 2001 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(gdb) run -X
Starting program: /wwwroot/bin/httpd -X
[New Thread 1024 (LWP 852)]
[New Thread 2049 (LWP 857)]
Delayed SIGSTOP caught for LWP 857.
[New Thread 1026 (LWP 858)]
Delayed SIGSTOP caught for LWP 858.
[New Thread 2051 (LWP 859)]
Delayed SIGSTOP caught for LWP 859.
[New Thread 3076 (LWP 860)]
Delayed SIGSTOP caught for LWP 860.
[New Thread 4101 (LWP 861)]
[New Thread 5126 (LWP 862)]
Delayed SIGSTOP caught for LWP 862.
[New Thread 6151 (LWP 863)]
Delayed SIGSTOP caught for LWP 863.
[New Thread 7176 (LWP 864)]
Delayed SIGSTOP caught for LWP 864.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 7176 (LWP 864)]
__pthread_mutex_lock (mutex=0x89110898) at mutex.c:99
99      mutex.c: No such file or directory.
        in mutex.c
(gdb)
 [2002-12-03 11:13 UTC] chregu@php.net
your backtrace is not of much use, but it looks like apache2 does backtraces differently than apache1.3 (or you didn't use --enable-debug or you're using threaded mpms within apache2, I have no experience with apache2...)

but, as I said in my last comment:

"sablotron < 0.97 and jdk >= 1.3 does not work together.
Sablotron 0.97 is not out yet, but there is an RC1 in their CVS (didn't find a link to download it), which should solve the problem.."

you're obviously (at least it's written in your ./configure lines) using sablotron. And sablotron <=0.96 does not work together with jdk >= 1.3... please try your installation without sablotron and see if that works.

chregu
 [2002-12-04 02:18 UTC] sebastian@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 [2002-12-05 09:06 UTC] ssruprai at hotmail dot com
No I didn't use sablotron last time. I only used --with-java and nothing else.

Anyway I'll try again enusuring --enable-debug and only --with-java is used.
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 17 06:02:13 2014 UTC