|
From: <php...@li...> - 2007-03-18 16:14:06
|
Hi Andrés,
>java_require("file://usr/local/apache2/htdocs/tests_java/Test.jar");
>
java_require("http://localhost/tests_java/Test.jar");
>
java_require("http://172.16.0.75/tests_java/Test.jar");
> java_require("Test.jar");
>
> And none of them seemed to work.
All of the above examples should work. Which error
message do you get?
Note that most modern Linux systems come with Security
Enhanced Linux enabled. This means that the folders
tests_java, DOCUMENT_ROOT/tests_java and htdocs must
be tagged appropriately. Furthermore the back end runs
in a sand box which can only access files and
directories which belong to httpd (or the "apache"
user on RedHat linux). Please see the readme the
documentation on php-java-bridge.sf.net for details.
> Which would be the most appropiate way?
Copy Test.jar into {php.java.bridge.base}/lib and use
java_require("Test.jar"); If you have installed from
RPM, this directory is tagged as lib_t and has the
correct permissions.
> > > VM: 3.4.3@http://gcc.gnu.org/java/
>
> Where should I define the VM that php/java bridge
> will work with?
It depends on how you start Java. As a sub component
of Apache or IIS? In this case the bridge uses the
java.java option from the php.ini.
> I actually installed the Java J2SE JDK from Sun on
> my box on /opt/jdk_ ...
> and that path is the one I set on the java.ini file.
The phpinfo() or the test.php page should display the
settings. Probably your system uses another .ini file
than you expect.
> Ok, I'll remove the java_reset() calls.
Most back ends ignore the java_reset() calls anyway.
Only the standalone container honors it. I thought
java_reset() generates enough noise so that people
don't use it in their scripts. Unfortunately it is
possible to suppress the warnings with the @operator.
> I shouldn't touch the CLASSPATH, right?
You can set it to any value you want. Java and the
PHP/Java Bridge don't care.
> I'm not sure about what you mean when you say
> wrappers.
I think hiding the libraries behind a facade is a bad
idea; people shouldn't write unnatural code. If you
have deployed your libraries into a J2EE back end, use
the libraries directly:
<?php
require_once("http://hostname:8080/JavaBridge/java/Java.inc");
java_require("foo.jar;bar.jar;...");
.. call your libraries ..
?>
If it turns out that some procedures should be
optimized, encapsulate the PHP code with the
java_begin_document()/java_end_document() pair. This
sends and executes the PHP code on the server side.
This is nearly as fast as Java code.
Regards,
Jost Boekemeier
___________________________________________________________
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de
|