ID: 18600
Comment by: Mike at 123456 dot net
Reported By: nalves at equifax dot com dot br
Status: Open
Bug Type: Java related
Operating System: Windows 2000
PHP Version: 4.2.3
New Comment:
Hi everybody,
I experience the problem of the "Unable to create Java Virtual
Machine", on a Windows 2000, with easyphp, after some search, my
conclusion is that you couldn't use (for the moment) php as a module in
Apache, you must for that use it in cgi mode (I tried it and it work
fine, and change from module to cgi mode doesn't affect usage of PHP).
My configuration is :
Windows 2000
Apache 2.0.45
J2SDK 1.4.1_02
PHP 4.3.2 RC3
You must install J2SK, Apache, and then php (the tutorial indicate how
to install in cgi mode), you can go to the following adress for
installation (a very good tutorial) :
http://hotwired.lycos.com/webmonkey/00/44/index4a_page8.html?tw=programming
after that just configure you php.ini with the following values :
[Java]
extension=php_java.dll
java.home = C:\j2sdk1.4.1_02\jre\bin
java.library = C:\j2sdk1.4.1_02\jre\bin\server\jvm.dll
java.library.path = C:\php4\extensions
java.class.path = "C:\php4\extensions\php_java.jar;C:\MyClasses;"
Don't forget to affect the extension_dir value like :
extension_dir=C:\php4\extensions
And now it's work.
Previous Comments:
------------------------------------------------------------------------
[2003-05-16 10:37:30] fj at hilab dot it
I personally have experienced the same problem with the 1.4.0_02 SDK
externally connected to php4.3.1 under Win2K.
I had very frequently the aforementioned 'Unable to create Java Virtual
Machine' error and after a number of tests I discovered that such error
never happened the first time I restarted the php engine by restarting
the Apache server.
This made me think that the JVM is left in an abnormal state after the
php interpreter exits the page.
For this reason I inserted an explicit call to the System.exit(0) at
the very end of the page and this solved all the problems! The only
side effect is that now it is mandatory to call the flush() php
function, or the page will not be completely shown...
------------------------------------------------------------------------
[2003-05-07 16:35:51] db_farr at excite dot com
isnt there a way to close the instantiated class and release the
resources?????
like the unset() command....
seems that would clear any resource retention problem and allow php to
reinstantiate the jvm.
------------------------------------------------------------------------
[2003-05-01 14:35:34] sohelnmerchant at yahoo dot com
Hi,
I am using PHP as a SAPI modlue in Apache (as it was recommended in the
readme file that its unsafe to use PHP in CGI mode) on windows.
Whenever I try to use a java class I keep on getting this problem
"Unable to create Java Virtual Machine". Some people have sggested to
use CGI version instead of SAPI. But I dont wanna use it for the
reasons mentioned above. I am wondering, if there exist any patch which
can eliminate this problem.
Thanks,
Sohel Merchant.
------------------------------------------------------------------------
[2003-04-30 05:27:08] belin at fc-net dot fr
Running Apache 1.3.22 and PHP 4.3.1 as module,
sablotron IS NOT enabled,
and I use JDK 1.4.0_01
after many times configuring php.ini
(there is jvm.dll bundled with my php distrib
but it seems to be useless, I used the jvm.dll
into the jre\server directory).
well well well...
it works when my PHP code is fully clean,
even if I reload my page several times.
now, let's try to make a little error...
if i try to create an object
(using $o = new Java(java_class_name))
if the class exists... no problem, if it
doesn't, just get an error but all is ok,
now if I try a java_class_name starting
with a lowercase character...
-> Unable to load virtual machine
ok ok. close explorer, modify the script,
and rewrite it correctly... lauching IE...
and the script...
-> Unable to load virtual machine
seems that if one error occurs everything after
is bad, even if it would not !
-> and then, the only thing to do is to shutdown
apache, and restart it... then the script goes ok...
conclusion. at the first error, shutdown and restart
apache, aaaaaargh ????
NOTE : this is only true for the apache module, when
using the cli version of php (command line), no
probleme with java VM...
hope it helps.
-Nicolas, french coder ;o)
------------------------------------------------------------------------
[2003-04-19 09:43:41] tuxo at gmx dot net
i experienced this problem too..
i want to use fop from xml.apache.org with the pear-class XML_fo2pdf to
produce pdf files.
system: win2k, apache 2.0.45, php 4.3.1, j2jdk 1.4.1.
any fixes available?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/18600
--
Edit this bug report at http://bugs.php.net/?id=18600&edit=1