php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16690 Java support in PHP with Apache2 multithreaded server doesn't work
Submitted: 2002-04-18 19:37 UTC Modified: 2003-11-17 22:38 UTC
Votes:64
Avg. Score:4.7 ± 0.7
Reproduced:52 of 53 (98.1%)
Same Version:33 (63.5%)
Same OS:40 (76.9%)
From: cunha17 at uol dot com dot br Assigned:
Status: Wont fix Package: Java related
PHP Version: 4.3.2RC4-dev OS: any
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2002-04-18 19:37 UTC] cunha17 at uol dot com dot br

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-18 19:56 UTC] cunha17 at uol dot com dot br
To get things working, I compiled PHP with these options:
./configure --with-bz2 --enable-ftp \
--with-gd --with-ttf --enable-gd-native-ttf --with-jpeg-dir \
--with-freetype-dir \
--with-png-dir --with-zlib-dir \
--with-tiff-dir \
--with-java --with-ldap \
--with-mcrypt --with-mhash \
--with-pdflib --without-mysql \
--with-pgsql --with-snmp --enable-shared \
--enable-calendar --with-dom --with-openssl \
--with-iconv=/usr/local/lib/libiconv.so \
--with-apxs2 --enable-experimental-zts

and Apache2 with these:
./configure --enable-ssl \
            --enable-module=so \
            --enable-modules=all \
            --enable-mods-shared=all \
            --with-mpm=prefork
 [2002-06-11 16:53 UTC] robert at ud dot com
This exact problem appears for me too on similar and different setups.

I get JVM timeouts on both Apache2(worker MPM)/Linux and Windows/IIS. The commonality is that they are both multi-threaded (same as reported).

Working setups where JVM works one or a few times and then "dies".

- Linux RH7.2/Apache 2.0.36 (worker MPM)/PHP 4.2.1/Sun JDK 1.4.0_01 (the "bleeding edge")
- Windows 2000/IIS/PHP 4.2.1/Sun JDK 1.3.1
 [2002-06-11 22:09 UTC] robert at ud dot com
More info:

Downgraded to Sun JDK 1.2.2 (from 1.4.0_01), recompiled PHP 4.2.1 (DSO into Apache 2.0.36), *and* removed the --enable-xslt and --with-xslt-sablot directives (because of some other reported bugs about ext/xslt and ext/java not playing nice) - all of this just to try a sane/clean build.
...but keeping the Apache 2.0.36 MPM as "worker" not "prefork".

Problem still occurs.
Basic PHP page with the usual example simple Java code loads/works correctly.  I can refresh the page every couple of seconds and it keeps working.  If I let it sit for a minute, and re-execute, the page returns blank and the PHP error log contains: "PHP Fatal error:  Unable to create Java Virtual Machine ....".  Sometimes, if I wait for a few minutes and try again, the page loads again correctly without error, but it is rather unpredictable exactly when it will work and when it wont (in other words, I can't set a stop watch by it).

I am now going to try build Apache2 with the prefork MPM and see if the behavior continues.
 [2002-06-12 15:06 UTC] robert at ud dot com
Just as I expected, everything now works normally and consistently the the ext/java extension using the "prefork" MPM with Apache2 and PHP 4.2.1.

The various problems reported with the ext/java methods "timing out"/"not loading" after one or a few successful hits clearly appears to be with multithreaded web server installations and PHP (Apache2 with worker MPM, IIS, etc..)

My latest, successful configure script:

LDFLAGS='-lstdc++' \
./configure \
    --with-apxs2=/usr/local/apache2/bin/apxs \
    --with-config-file-path=/usr/local/etc \
    --with-tsrm-pthreads \
    --enable-memory-limit \
    --without-pear \
    --disable-posix \
    --enable-mbstring \
    --enable-calendar \
    --enable-wddx \
    --enable-sockets \
    --enable-ftp \
    --with-zlib \
    --with-bz2 \
    --with-mhash \
    --with-iconv \
    --with-openssl \
    --with-expat-dir \
    --with-dom \
    --with-dom-xslt \
    --with-dom-exslt \
    --enable-xslt \
    --with-xslt-sablot \
    --with-mysql=no \
    --with-iodbc \
    --with-ldap \
    --with-imap \
    --with-curl \
    --with-png-dir \
    --with-jpeg-dir \
    --with-freetype-dir \
    --with-gd \
    --enable-gd-native-ttf \
    --with-java=/usr/local/java/jdk1.2.2
 [2002-10-04 16:45 UTC] iliaa@php.net
Not Apache 2 issue, rather a problem with ext/java/ not being thread safe, reclassifying.
 [2002-10-04 17:33 UTC] kalowsky@php.net
This really falls inline with the numerous Java/Windows bugs that we have logged.  My initial debugging of it shows that their problems are being caused by the non-multi-thread safe code.  Havne't been able to fix it yet though.
 [2003-05-21 17:40 UTC] cunha17 at uol dot com dot br
Why the status changed to SUSPENDED?
Does it mean that it is not important?
 [2003-11-17 22:38 UTC] sniper@php.net
Java support in PHP 4 has been extremely experimental since it was introduced. And the support for it has been dropped.

 [2004-07-04 03:37 UTC] rustamabd at columbus dot rr dot com
Without this fix, Java support is useless.
recommend reopening with highest priority.
 [2004-07-27 15:36 UTC] engel_o at yahoo dot com
Me too !
The interaction between Java and PHP is really important
 [2004-10-05 21:00 UTC] Supergurl11191 at aol dot com
jghjgjghjghj
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Fri Apr 18 10:03:03 2014 UTC