PHP AND JAVA

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
amolkad
Forum Newbie
Posts: 22
Joined: Tue Jun 01, 2004 7:22 am

PHP AND JAVA

Post by amolkad »

Hello,

Can any one tell me steps to connect php with java.
Thanks,
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

[php_man]java[/php_man]
amolkad
Forum Newbie
Posts: 22
Joined: Tue Jun 01, 2004 7:22 am

Post 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\
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

did you uncomment the java extension in your extension settings?
amolkad
Forum Newbie
Posts: 22
Joined: Tue Jun 01, 2004 7:22 am

Post by amolkad »

extension=php_java.dll is enabled.

still getting error?

:(
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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
Post Reply