From: <tec...@us...> - 2005-09-10 13:58:22
|
||*()*|| Greetings, php-java-bridge-users.. Here is the list of proposals/enchantments I've come up with to increase overall first look expression from this bundle. 1. BUG. There is no PHP4 version of library in php-java-bridge_2.0.8RC2 windows distributuive. 2. About 80% of windows distributive size is php5ts.dll Is it possible to make alternative -light version? 3. Patch to make test run even if unzipped not in c:/php5 --- java.ini_old.windows Wed Sep 7 20:54:34 2005 +++ java.ini.windows Sat Sep 10 13:46:30 2005 @@ -7,7 +7,7 @@ ;; double-click on JavaBridge.jar or deploy JavaBridge.war into your ;; servlet engine/application server and re-start it. -extension_dir = "c:\php5" +extension_dir = "." extension = php_java.dll [java] 4. JavaBridge.jar doesn't output any messages about it was started successfully, doesn't respond to command-line parameters and works like invisible service (which is good to see optional) 5. Test could try to execute JavaBridge.jar and shut it down after complete. Is there any ways to control running server? 6. It would be good to have a ToC in readme. Questions about bridge (I'm total noob in Java programming): Q1. Is it possible to extend Java class with PHP? I.e. make PHP class, inherited from one of Java? .techtonik -- |
From: Jost B. <jos...@ya...> - 2005-09-12 16:29:58
|
Hi, > 1. BUG. There is no PHP4 version of library in The PHP/Java Bridge does not work on threaded HTTP servers, e.g. IIS, unless ZTS is switched on. ZTS is experimental in all versions below PHP 5 and I know of at least 3 incompatible ABI's since 4.3.2. So the question is: which version of PHP4 on windows should we support? Isn't it possible to compile your own php4 binary as described in the README? > 2. About 80% of windows distributive size is > php5ts.dll > Is it possible to make alternative -light version? Yes, certainly. But is 3MB really too large these days? > 3. Patch to make test run even if unzipped not in > c:/php5 Isn't it possible to adjust the php.ini accordingly? One has to do this during the installation process anyway. But the widgetTest.bat could be changed, of course. > 4. JavaBridge.jar doesn't output any messages about > it was started successfully If you start it at log level 3 or above, as described in the README, it will output to stdout or to a log file. > complete. Is there any ways to control running > server? "apachectl start" starts the apache server and the bridge and "apachectl stop" stops both, please see the README for details. Since version 2.0.8 this works on windows, too. However, the recommended way to run the backend is to start it via the php-java-bridge.service script (on Unix) or via tomcat (on windows). > 6. It would be good to have a ToC in readme. Yes. > Q1. Is it possible to extend Java class with PHP? > I.e. make PHP class, inherited from one of Java? The java_closure() call currently accepts only interfaces, not classes. It would be nice if the Sun's dynamic proxy would accept a class, but it doesn't. If we want this, we must write our own proxy compiler. Please see http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/java/lang/reflect/Proxy.java?rev=1.13.2.6&content-type=text/vnd.viewcvs-markup Regards, Jost Boekemeier ___________________________________________________________ Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de |
From: <tec...@us...> - 2005-09-17 16:04:57
|
||*()*|| [\..konnichi wa, ogenki desu ka, Jost../] Monday, September 12, 2005, 6:29:49 PM, you wrote: >> 1. BUG. There is no PHP4 version of library in JB> The PHP/Java Bridge does not work on threaded HTTP JB> servers, e.g. IIS, unless ZTS is switched on. JB> ZTS is experimental in all versions below PHP 5 and I JB> know of at least 3 incompatible ABI's since 4.3.2. JB> So the question is: which version of PHP4 on windows JB> should we support? Isn't it possible to compile your JB> own php4 binary as described in the README? 4.4.0 - at least you can always ask new users to get latest version of PHP to avoid bugs introduced earlier. I've tried to compile PHP myself from CVS, but failed. And also I don't use any web-server - I want to try mix of Java and PHP in standalone application. >> 2. About 80% of windows distributive size is >> php5ts.dll >> Is it possible to make alternative -light version? JB> Yes, certainly. But is 3MB really too large these JB> days? Yes, sometimes. It will be nice if this application could detect presence of PHP and link it dynamically regardless of PHP5/PHP4 differences and without additional path setup. >> 3. Patch to make test run even if unzipped not in >> c:/php5 JB> Isn't it possible to adjust the php.ini accordingly? JB> One has to do this during the installation process JB> anyway. But the widgetTest.bat could be changed, of JB> course. I like things like unzip and run. Like any lazy user I hate doing things that could be automated or not intuitively setup by default. Especially test-cases. =) >> 4. JavaBridge.jar doesn't output any messages about >> it was started successfully JB> If you start it at log level 3 or above, as described JB> in the README, it will output to stdout or to a log JB> file. README is very long and contains a lot of information. Read 25k just to find command line options (especially if there are not any) is a waste of time. I thought it should be good for an application to react on help/unknown cmd parameters to be user-friendly. >> complete. Is there any ways to control running >> server? JB> "apachectl start" starts the apache server and the JB> bridge and "apachectl stop" stops both, please see the JB> README for details. Since version 2.0.8 this works on JB> windows, too. JB> However, the recommended way to run the backend is to JB> start it via the php-java-bridge.service script (on JB> Unix) or via tomcat (on windows). The bridge is not running under Tomcat or Apache - it is supposed to be used for standalone application in my case. And yes - it is windows. >> 6. It would be good to have a ToC in readme. JB> Yes. =) >> Q1. Is it possible to extend Java class with PHP? >> I.e. make PHP class, inherited from one of Java? JB> The java_closure() call currently accepts only JB> interfaces, not classes. It would be nice if the Sun's JB> dynamic proxy would accept a class, but it doesn't. If JB> we want this, we must write our own proxy compiler. I don't think it is easy, esp. for me. =) Probably It should be easier to create a proxy Java object, which will call invokable PHP functions where it needed. The problem is that I still unsure if I've got the whole picture of this bridge and how to plug it into Java application correctly. WBR.techtonik -- (B)uilding, (A)ntenna, (S)pan and (E)arth * terminal velocity - 54m/s, 305m * |
From: Jost B. <jos...@ya...> - 2005-09-23 10:46:17
|
Hi, [please excuse the delay] > 4.4.0 - at least you can always ask new users to get > latest version of > PHP to avoid bugs introduced earlier. Well, people have a reason why they use php 4.3.2, 4.3.3 or 4.4.0 or 5.0.x. Certain extensions only work in one of these versions. So if users what to use a specific version of php for which no binary exists, I usually ask them to compile from source. > I've tried to > compile PHP myself > from CVS, but failed. Which errors specifically? > I want to try mix of Java and PHP in > standalone application. I didn't think this is possible. PHP is missing features which are essential for desktop applications. For example it doesn't have threads; it relies on the web server to provide an "execution environment". There are other environments which support the PHP programming language for example a php -> CIL compiler exists for the MONO project. > Yes, sometimes. Okay. I think it is possible to split the zip file into a "documentation" zip and a zip file which contains the php_java.dll, the php.ini and a short readme. > I like things like unzip and run. Like any lazy user > I hate doing > things that could be automated I don't see how this could be automated. Some people use IIS, others prefer apache. > README is very long and contains a lot of > information. Read 25k just > to find command line options (especially if there > are not any) is a > waste of time. I thought it should be good for an > application to > react on help/unknown cmd parameters to be > user-friendly. Sorry, the parameters are documented in the INSTALL.WINDOWS document only. The README is indeed a little bit unix centric; unix users usually start the bridge via the php-java-bridge.service script or via the php-java-bridge command. If you install with "rpm -i php-java-bridge*.rpm" or by double-clicking on the .rpm, the RPM package manager will automatically set this up. AFAIK windows doesn't have such a setup program. But I am not a windows expert, though. > I don't think it is easy, esp. for me. =) What I meant was: Isn't it possible to use java_closure() for this? For example: <? class test { function toString() { $sys=new JavaClass("java.lang.System"); return "Hello java from php@" . $sys; } } $t = new test(); $javaT = java_closure($t); echo $javaT; ?> => [proxy0: "Hello java from php@100982"] The problem is that Sun's dynamic proxy doen't accept a super class, i.e. the parent class is always java.lang.Object. There are several open source implementations which change this. But in practice I think this isn't an issue. You can always delegate, e.g. use the decorator pattern. Regards, Jost Boekemeier ___________________________________________________________ Was denken Sie über E-Mail? Wir hören auf Ihre Meinung: http://surveylink.yahoo.com/wix/p0379378.aspx |
From: techtonik <tec...@tu...> - 2005-10-29 09:44:00
|
||*()*|| [\..konnichi wa, ogenki desu ka, Jost../] >> I've tried to compile PHP myself from CVS, but failed. JB> Which errors specifically? Something about PCRE, but the problem was in CVS version of PHP4. I downloaded 4.4.0 sources and compiled them successfully, but failed to build bridge. According to INSTALL "Compiling a CGI binary on Windows" > 1. Install the source code of PHP 4.3.x or higher. > > 2. Install RedHat's Cygwin (PHP needs autoconf). > > 3. Delete the java sub-directory from php-4.3.x\ext. Copy the > php-java-bridge directory to the php-x.y.z\ext directory and > rename it to java. Update the "m4_include" paths in > php-x.y.z\ext\java\config.m4 so that they start with "ext/java/": > > m4_include(ext/java/tests.m4/function_checks.m4) > m4_include(ext/java/tests.m4/java_check_broken_stdio_buffering.m4) > ... > m4_include(ext/java/tests.m4/java_check_broken_gcc_installation.m4) > > 4. Invoke autoconf to register our java module within the PHP build > tree: > > buildconf.bat --force > BTW, there is not .bat, but "./buildconf --force" launches ok. > Instead of running "buildconf" you can also use autoconf directly: > > autoconf Also tried this way. > Then configure and compile php as usual: > > .\configure --with-java=%JAVA_HOME% After some time this stops with error. ---cut--- ... checking for Ingres II support... no checking for InterBase support... no checking for IRCG support... no ./configure: line 45991: syntax error near unexpected token `ext/java/tests.m4/function_checks.m4' ./configure: line 45991: `m4_include(ext/java/tests.m4/function_checks.m4)' UIUST@uiust /cygdrive/d/DeveloperSpace/InProjects/php-src/php-src $ ---cut--- Whole java-bridge 2.0.8 src directory content is located at ext/java and function_checks.m4 exists. $ ls -gGa ext/java/tests.m4/ total 28 drwxr-xr-x 2 0 Oct 24 10:46 . drwxr-xr-x 11 0 Oct 24 10:44 .. -rw-r--r-- 1 753 Sep 19 19:52 function_checks.m4 -rw-r--r-- 1 1712 Sep 19 19:52 java_check_abstract_namespace.m4 -rw-r--r-- 1 775 Sep 19 19:52 java_check_broken_gcc_installation.m4 -rw-r--r-- 1 2131 Sep 19 19:52 java_check_broken_stdio_buffering.m4 -rw-r--r-- 1 2286 Sep 19 19:52 java_check_struct_ucred.m4 -rw-r--r-- 1 4747 Sep 19 19:52 threads.m4 > make >> I want to try mix of Java and PHP in >> standalone application. JB> I didn't think this is possible. PHP is missing JB> features which are essential for desktop applications. JB> For example it doesn't have threads; it relies on the JB> web server to provide an "execution environment". Isn't it possible for Java application to provide execution environment and call PHP interpretator for script processing? JB> There are other environments which support the PHP JB> programming language for example a php -> CIL compiler JB> exists for the MONO project. No, thanks, I'd like to find a way how can I use PHP scripting capabilities from Java. =) JB> Okay. I think it is possible to split the zip file JB> into a "documentation" zip and a zip file which JB> contains the php_java.dll, the php.ini and a short JB> readme. Would be nice, but I've already bogged down in compilation. >> README is very long and contains a lot of information. >> Read 25k just to find command line options (especially if >> there are not any) is a waste of time. I thought it should >> be good for an application to react on help/unknown cmd >> parameters to be user-friendly. JB> Sorry, the parameters are documented in the JB> INSTALL.WINDOWS document only. The README is indeed a JB> little bit unix centric; unix users usually start the JB> bridge via the php-java-bridge.service script or via JB> the php-java-bridge command. Well, I just thought it would be nice for javabridge to spill usage info if garbage was passed in command line parameters. This also help to detect errors in launching scripts configuration. WBR.techtonik -- (B)uilding, (A)ntenna, (S)pan and (E)arth * terminal velocity - 54m/s, 305m * |
From: Jost B. <jos...@ya...> - 2005-10-29 12:31:37
|
Hi, > Isn't it possible for Java application to provide > execution > environment and call PHP interpretator for script > processing? Yes. This feature will be available with PHP/Java Bridge 3.0 which will be published in december. The version 2.0.8 already supports everything necessary to fully implement jsr 223 except that some methods are currently private. But if you make the Context class and the getContext() method public, you can already call php scripts from java: * "include" the php instance from the apache pool and pass it the current java continuation * the php instance closes over its environment (see java_closure) and passes it to the passed java continuation * in your java continuation you can call into the closure as often as you want. * when the java continuation (e.g. the service method) terminates all allocated php continuations terminate, too. Regarding the compilation on windows, Steven has posted an excellent article on the list, please see http://sourceforge.net/tracker/index.php?func=detail&aid=1322743&group_id=117793&atid=679233 Regards, Jost Boekemeier ___________________________________________________________ Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de |