|
From: <php...@li...> - 2010-07-21 14:48:58
|
Hi,
why don't you simply use an Ant exec task. The build.xml shipped with
the JavaBridge source code uses this, too.
> So my questions are these:
> 1. Does the PHP Java Bridge support some means of identifying the location
> that it should search for an PHP executable in, either by adding it to the
> common paths in Util.Process or by just searching on the path given? Even if
> this functionality isn't provided "out-of-the-box" so to speak, is there an
> class that is easily extensible that I could leverage to make it work in
> this manner (maybe a new ScriptEngine, Factory, Context?)
You can use -Dphp.java.bridge.php_exec=/path/to/php-cgi.exe if php-cgi
is not in the PATH. Please see php.java.bridge.global.properties file
and our FAQ entry "How can I configure the bridge?"
> 2. Does the PHP Java Bridge support setting command line arguments on the
> PHP executable (e.g. "-d foo=bar")? If it does not, is there any way to
> extend existing classes to add this functionality and if so what classes
> should I look at?
Yes, please see PHP_EXEC_ARGS from the
php.java.bridge.global.properties file and our FAQ entry "How can I
configure the bridge?"
> 3. Does the PHP Java Bridge support setting script level arguments? Again,
> if it does not, is there any way to extend existing classes to add this
> functionality and if so what classes should I look at?
What are script-level arguments? Do you mean JSR 223 bindings? Please
see the JSR 223 specification for details.
> I was going a bit cross-eyed tracking the code where it gets executed and by
> whom.
(new ScriptEngineManager()).getEngineByName("php").eval("<?php exit(1+2);");
is just a glorified version of System.exec(...), as long as you don't
decorate the standard ScriptContext. So it isn't very useful for your
task.
> Also, as an aside, I stumbled upon the LauncherWindows classes... and I'm
> not really sure what it is that they do. I mean, I can tell they are four
> parts of a binary file definition, but what binary? I'm curious.
It is the launcher.exe, encoded in 4 64k chunks (due to constraints of
the JVM). Please see target name="LauncherWindows" in
http://php-java-bridge.cvs.sourceforge.net/viewvc/php-java-bridge/php-java-bridge/build.xml?view=markup
> (Note: I originally sent this before subscribing to the list and it got
> stuck in a "requires moderator approval" queue, so I resent it.
That's a "honeypot" to make spammers happy.
Regards,
Jost Boekemeier
|