|
From: <php...@li...> - 2009-01-06 07:08:05
|
Hi all,
Well i'm having a silly problem getting the latest release (5.4.2) to
extract so that I can test compatibility with our Web application. I
am currently running version 3.2.1 in production (has been running
for over a year beautifully).
As I am a complete noob when it comes to Java, this is likely a very
simple problem I hope. I am running Mac OS X 10.4.11.
I copied the downloaded folder to my Mac Web directory at /Library/
WebServer/Documents/php-java-bridge_5-1/
Here is my terminal output for three different attempts:
1) Using the installation instructions verbatim:
iMac:/Library/WebServer/Documents/php-java-bridge_5-1 jkoerber$ java -
classpath JavaBridge.war TestInstallation
java.io.FileNotFoundException: /Library/WebServer/Documents/php-java-
bridge_5-1/JavaBridge.war:/System/Library/Frameworks/JavaVM.framework/
Versions/1.5.0/Classes/.compatibility/ext/JavaBridge.jar (Permission
denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
at TestInstallation.extractFile(TestInstallation.java:351)
at TestInstallation.start(TestInstallation.java:283)
at TestInstallation.main(TestInstallation.java:251)
iMac:/Library/WebServer/Documents/php-java-bridge_5-1 jkoerber$
2) Specifying a path for "-classpath"
iMac:/Library/WebServer/Documents/php-java-bridge_5-1 jkoerber$ java -
classpath /Library/WebServer/Documents/php-java-bridge_5-1/
JavaBridge.war TestInstallation
java.io.FileNotFoundException: /Library/WebServer/Documents/php-java-
bridge_5-1/JavaBridge.war:/System/Library/Frameworks/JavaVM.framework/
Versions/1.5.0/Classes/.compatibility/ext/JavaBridge.jar (Permission
denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
at TestInstallation.extractFile(TestInstallation.java:351)
at TestInstallation.start(TestInstallation.java:283)
at TestInstallation.main(TestInstallation.java:251)
iMac:/Library/WebServer/Documents/php-java-bridge_5-1 jkoerber$
3) Running as superuser (since I noticed the permission denied message)
iMac:/Library/WebServer/Documents/php-java-bridge_5-1 jkoerber$ su root
Password:
iMac:/Library/WebServer/Documents/php-java-bridge_5-1 root# java -
classpath /Library/WebServer/Documents/php-java-bridge_5-1/
JavaBridge.war TestInstallation
Starting a simple servlet engine: [/System/Library/Frameworks/
JavaVM.framework/Versions/1.5.0/Home/bin/java, -jar, /Library/
WebServer/Documents/php-java-bridge_5-1/JavaBridge.war:/System/
Library/Frameworks/JavaVM.framework/Versions/1.5.0/
Classes/.compatibility/ext/JavaBridge.jar, SERVLET_LOCAL:8080]
Exception in thread "main" java.lang.NoClassDefFoundError: php/java/
bridge/Standalone
Invoking php: [php-cgi, -n, -d, allow_url_include=On, /Library/
WebServer/Documents/php-java-bridge_5-1/JavaBridge.war:/System/
Library/Frameworks/JavaVM.framework/Versions/1.5.0/
Classes/.compatibility/test.php]
java.lang.RuntimeException: Could not run PHP ([php-cgi, -n, -d,
allow_url_include=On, /Library/WebServer/Documents/php-java-
bridge_5-1/JavaBridge.war:/System/Library/Frameworks/JavaVM.framework/
Versions/1.5.0/Classes/.compatibility/test.php]), please check if php-
cgi is in the path.
at TestInstallation.start(TestInstallation.java:327)
at TestInstallation.main(TestInstallation.java:251)
Caused by: java.io.IOException: php-cgi: not found
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:52)
at java.lang.ProcessImpl.start(ProcessImpl.java:91)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
at java.lang.Runtime.exec(Runtime.java:591)
at java.lang.Runtime.exec(Runtime.java:507)
at TestInstallation.start(TestInstallation.java:325)
... 1 more
iMac:/Library/WebServer/Documents/php-java-bridge_5-1 root#
I appreciate any tips on why I am unable to get the .war file to
unzip on my Mac.
Thanks
-- Jon
|
|
From: <php...@li...> - 2009-01-06 15:51:14
|
Hi John, > java.lang.RuntimeException: Could not run PHP ([php-cgi, what about adding a OSX php-cgi binary to the JavaBridge.war file? AFAIK OSX doesn't ship with a php-cgi binary. Furthermore all current PHP binaries aren't exactly stable (see this regression for example: http://bugs.php.net/bug.php?id=46723&edit=1), anyway. So it might be a good idea to ship a stable PHP binary along with the PHP/Java Bridge. The Solaris/Linux/... PHP binaries conntained in JavaBridge.war which have been compiled with: cd php-5.1.4; ./configure --disable-all --enable-fastcgi && make && strip sapi/cgi/php-cgi Could you provide such a php-cgi binary for OSX? Regards, Jost Boekemeier |
|
From: <php...@li...> - 2009-01-21 10:09:19
|
Hi Jost, (sorry for the delay in this response - I sent this originally on the 1/12 using the wrong email address) In the environment I am using (and many other Mac OSX and Mac OSX Server users), the PHP module is an Apache SO and the PHP command line interface is actually a .bin executable and not a fast CGI. I utilize a variety of CRON jobs and such that call the PHP command- line executable directly for non-interactive PHP scripts. Since I don't use the php-cgi I am not sure adding one to the bridge package will help me or maybe other Mac OSX Server users. In the version I am currently running, 3.2.1, I compiled the java bridge from your source files to run as an extension to PHP in Apache 1.3.x and also to run from the command line PHP executable. I am not sure if you have changed the overall structure of the bridge to no longer support this way of doing things or the original stand- alone pure PHP implementation of the bridge you used to have as well. If there is still a pure PHP version of the bridge, maybe that is the way I should go. Otherwise, I am not sure the best way to upgrade to the new bridge from version 3.2.1 (which is working great). Jon On Jan 6, 2009, at 7:51 AM, php-java-bridge- us...@li... wrote: > Hi John, > >> java.lang.RuntimeException: Could not run PHP ([php-cgi, > > what about adding a OSX php-cgi binary to the JavaBridge.war file? > AFAIK OSX doesn't ship with a php-cgi binary. Furthermore all > current PHP binaries aren't exactly stable (see this regression for > example: http://bugs.php.net/bug.php?id=46723&edit=1), anyway. So > it might be a good idea to ship a stable PHP binary along with the > PHP/Java Bridge. > > The Solaris/Linux/... PHP binaries conntained in JavaBridge.war > which have been compiled with: > > cd php-5.1.4; ./configure --disable-all --enable-fastcgi && make > && strip sapi/cgi/php-cgi > > Could you provide such a php-cgi binary for OSX? > > > Regards, > Jost Boekemeier |
|
From: <php...@li...> - 2009-01-21 17:05:30
|
Hi Jon, the main problem with version 3.2.1 is the hook into the Zend evaluator (the java.so or php_java.dll). Because the PHP low-level API changes constantly, it is impossible to maintain version 3.2.1 or below (PHP/Java Bridge 3.2.1 will no longer work with PHP 5.3 or PHP 6). >From Java's point of view a php-cgi (fast cgi executable) is a requirement. Otherwise you won't be able to run PHP interactively. As far as I know the interactive JSR 223 script engine is the only way to start a REPL. -- The php cli can be started with the -a flag, which emulates an interactive PHP session, but this doesn't really work well in practice: $ php -a php > foo(); crash Of cause there are other PHP implementations, some are written in pure Java. But none of them is 100% compatible with the PHP script engine from php.net, which renders these implementations useless. Regards, Jost Boekemeier |
|
From: <php...@li...> - 2009-01-27 07:36:17
|
On Jan 21, 2009, at 9:05 AM, php-java-bridge-
us...@li... wrote:
> Hi Jon,
>
> the main problem with version 3.2.1 is the hook into the Zend
> evaluator (the java.so or php_java.dll). Because the PHP low-level
> API changes constantly, it is impossible to maintain version 3.2.1
> or below (PHP/Java Bridge 3.2.1 will no longer work with PHP 5.3 or
> PHP 6).
I do remember needing to recompile the phpJava bridge whenever I
upgraded my PHP version. I assume you are saying by the above that I
could no longer simply recompile the 3.2.1 bridge source with the
latest PHP source to produce a viable bridge extension to PHP, is
that right?
>
>> From Java's point of view a php-cgi (fast cgi executable) is a
>> requirement. Otherwise you won't be able to run PHP interactively.
>> As far as I know the interactive JSR 223 script engine is the only
>> way to start a REPL. -- The php cli can be started with the -a
>> flag, which emulates an interactive PHP session, but this doesn't
>> really work well in practice:
>
Are you speaking from the point of view of someone who is trying to
access PHP from Java -or- call Java libraries from PHP? I need to do
the latter, call Java .jar files from PHP. My applications are pure
PHP web-based applications but I need to be able to make calls
through a 3rd party java library (provided by a vendor of mine) from
my PHP applications (all interactive Web sites) that processes credit
card transactions.
It seemed easy with the old 3.2.1 version of the bridge since all I
did was compile the bridge as a PHP extension and then make simple
calls from within my PHP. Here is a stripped down (but nearly
complete) example of the main script I use that communicates with our
vendors merchant processing platform via their Java API called from
our PHP web application:
java_require(3rd party jar files...);
$props = new Java("java.util.Properties");
$props->put("someval","sourcedir");
etc...
$request = new Java("java.util.HashMap");
..fill $request with all calling variables...
try {
$reply_class = new JavaClass("com.vendor.ws.client.Client");
$my_reply = new JavaClass("java.util.HashMap");
$my_reply = $reply_class->runTransaction($request , $props);
$vendor_reply = java_values($my_reply); //--- bust reply values
back into PHP readable array
} catch (java_exception $err) {
handle errors
}
Is it possible to do the same thing with the latest release similar
to this. Also if there is not a way for me to create the same
javaBridge PHP extension as in the old 3.2.1 version, is the pure PHP
implementation still available?
Thanks again for the great assistance.
Also if there are any other OS X users out there, feel free to jump
in with any suggestions/help you may have for me.
Jon Koerber
> $ php -a
> php > foo();
> crash
>
>
> Of cause there are other PHP implementations, some are written in
> pure Java. But none of them is 100% compatible with the PHP script
> engine from php.net, which renders these implementations useless.
>
>
> Regards,
> Jost Boekemeier
>
>
>
>
>
> ----------------------------------------------------------------------
> --------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> php-java-bridge-users mailing list
> php...@li...
> https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users
|
|
From: <php...@li...> - 2009-01-27 17:45:36
|
Hi Jon,
> [...] I assume you are saying by the
> above that I could no longer simply recompile the 3.2.1 bridge source
> with the latest PHP source to produce a viable bridge extension to
> PHP, is that right?
Yes.
> Are you speaking from the point of view of someone who is
> trying to access PHP from Java -or- call Java libraries from PHP?
Both still work. It's just that the java.so/php_java.dll extension is not necessary anymore (PHP >= 1.4).
> It seemed easy with the old 3.2.1 version of the bridge
It is even easier now that we've scrapped the java extension. Just install a servlet engine or J2EE server on a computer within your intranet and use:
require_once("http://yourServer:8080/JavaBridge/java/Java.inc");
in your scripts to access it.
If you want to start Java with each PHP script invocation, use the JSR 223 API (Java >= 1.6):
jrunscript -classpath JavaBridge.jar -l php testScript.php
> java_require(3rd party jar files...);
> $props = new Java("java.util.Properties");
> $props->put("someval","sourcedir");
Yes. Just add a java_require(".../Java.inc") to your script.
Regards,
Jost Boekemeier
|
|
From: <php...@li...> - 2009-02-01 18:57:45
|
Jost,
Okay, so I am looking into installing/enabling a servlet engine under
OS X Server. That still leaves me with one issue, how can I extract
the files I need from the JavaBridge package without a PHP fast-cgi?
Since I only have a PHP binary and the Apache php.so extension.
Is there any other way to get the files I need from the bridge
package? Any help appreciated.
Jon
On Jan 27, 2009, at 9:45 AM, php-java-bridge-
us...@li... wrote:
> Hi Jon,
>
>> [...] I assume you are saying by the
>> above that I could no longer simply recompile the 3.2.1 bridge
>> source
>> with the latest PHP source to produce a viable bridge extension to
>> PHP, is that right?
>
> Yes.
>
>
>> Are you speaking from the point of view of someone who is
>> trying to access PHP from Java -or- call Java libraries from PHP?
>
> Both still work. It's just that the java.so/php_java.dll extension
> is not necessary anymore (PHP >= 1.4).
>
>
>> It seemed easy with the old 3.2.1 version of the bridge
>
> It is even easier now that we've scrapped the java extension. Just
> install a servlet engine or J2EE server on a computer within your
> intranet and use:
>
> require_once("http://yourServer:8080/JavaBridge/java/Java.inc");
>
> in your scripts to access it.
>
> If you want to start Java with each PHP script invocation, use the
> JSR 223 API (Java >= 1.6):
>
> jrunscript -classpath JavaBridge.jar -l php testScript.php
>
>
>
>> java_require(3rd party jar files...);
>> $props = new Java("java.util.Properties");
>> $props->put("someval","sourcedir");
>
> Yes. Just add a java_require(".../Java.inc") to your script.
>
>
> Regards,
> Jost Boekemeier
>
>
>
>
>
> ----------------------------------------------------------------------
> --------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> php-java-bridge-users mailing list
> php...@li...
> https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users
|
|
From: <php...@li...> - 2009-02-02 18:03:02
|
Hi,
> Okay, so I am looking into installing/enabling a servlet
> engine under OS X Server.
Tomcat and Jetty will work out of the box. Tomcat is a little bit easier to handle because of its autodeploy mode.
> That still leaves me with one issue, how can I extract
> the files I need from the JavaBridge package without a PHP
You don't need to extract anything, the deployment tool built into tomcat knows how to handle .war files. It automatically extracts all necessary files into the webapps folder, right after you have copied the .war file into it.
Just copy JavaBridge.war to Tomcat's "webapps" folder, wait one second and that's it.
Regards,
Jost Bökemeier
|
|
From: <php...@li...> - 2009-02-02 20:22:58
|
Jost, Thanks again for your dedication and amazing support for your phpJava bridge project. I will be working on this over the next couple weeks to see how I can pull this all together and get it working. I will do my best to report back (or add some pages to the Web site) on the method for running the new 5.4.3 binaries on the OS X Client and OS X Server platforms (Both Tiger 10.4 and Leopard 10.5). Cheers. Jon Koerber On Feb 2, 2009, at 10:01 AM, php-java-bridge- us...@li... wrote: > Hi, > >> Okay, so I am looking into installing/enabling a servlet >> engine under OS X Server. > > Tomcat and Jetty will work out of the box. Tomcat is a little bit > easier to handle because of its autodeploy mode. > > >> That still leaves me with one issue, how can I extract >> the files I need from the JavaBridge package without a PHP > > You don't need to extract anything, the deployment tool built into > tomcat knows how to handle .war files. It automatically extracts > all necessary files into the webapps folder, right after you have > copied the .war file into it. > > Just copy JavaBridge.war to Tomcat's "webapps" folder, wait one > second and that's it. > > > > Regards, > Jost Bökemeier > > > > > > ---------------------------------------------------------------------- > -------- > This SF.net email is sponsored by: > SourcForge Community > SourceForge wants to tell your story. > http://p.sf.net/sfu/sf-spreadtheword > _______________________________________________ > php-java-bridge-users mailing list > php...@li... > https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users |