Page 1 of 1

PHP AND JAVA

Posted: Mon Jun 21, 2004 2:09 am
by amolkad
Hello,

Can any one tell me steps to connect php with java.
Thanks,

Posted: Mon Jun 21, 2004 2:12 am
by feyd
[php_man]java[/php_man]

Posted: Mon Jun 21, 2004 2:21 am
by amolkad
I am getting following error.

Fatal error: Unable to create Java Virtual Machine in D:\_amolk_workspace\AmolTest\java.php on line 29
PHP: Error parsing C:\WINNT\php.ini on line 604

My php-ini file has follwoing setting


[Java]
java.class.path=C:\PHP\extensions\php_java.jar;
java.home = c:\Progra~1\JavaSoft\JRE\1.3.0_01
java.library = c:\Progra~1\JavaSoft\JRE\1.3.0_01\bin\hotspot
java.library.path = c:\PHP\extensions\

Posted: Mon Jun 21, 2004 2:29 am
by feyd
did you uncomment the java extension in your extension settings?

Posted: Mon Jun 21, 2004 2:32 am
by amolkad
extension=php_java.dll is enabled.

still getting error?

:(

Posted: Mon Jun 21, 2004 2:38 am
by feyd
saw this in the manual, dunno if it's applicable...
For those who have problems(1) with the broken(2) php/java module that is shipped with php, there's an alternative which is technically superior:

-> http://www.phpbuilder.com/lists/php-gen ... 2/0718.php

The author says that the module does not yet work on Windows, though. But I guess it should not be difficult to change the Unix fork/exec calls into the windows equivalent.

(2) http://tjw.org/php_java/build_notes.php
(1) These problems have technical reasons (extension dlopened):
* Fatal error: Unable to load Java Library
* [must] symlink "java.so" in your php extensions directory to
* ldconfig is needed
* LDFLAGS=-lpthread needed
* did not get to work PHP with Suns JDK 1.4.0_01 (Apache crashes), but JDK 1.4.2 works.
* the running httpd process, keeps the class file somewhere in cache
* [exec call is] considerably faster than accessing the same functionality with the JAVA extension