Re: PHP scripting engine plugin v0.1
Daniel Ruthardt <[email protected]> Tue, 12 Aug 2008 09:59:00 +0200
| Newsgroups | gmane.comp.java.helma.general |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
--===============1073615968==
Content-Type: multipart/alternative;
boundary="------------000507000501030809080501"
This is a multi-part message in MIME format.
--------------000507000501030809080501
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Hi Maks,
Quercus is pretty much the best product I was able to find to connect
Java and PHP. Of course I do know, that native PHP is able to use Java,
but with Quercus its even easier to use Java from within PHP, but most
important the integration effectively works in both directions.
After having finished the first release of the PHP plugin, I can judge
the Quercus engine as being quite easy to integrate in any Java
application. Especially extending the the PHP context with additional
modules (like the GlobalObject does it for JS) is extremely easy and far
more straightforward than what I could see how it is done for the JS
context.
The motivation however of writing the plugin was not that I prefer
(Quercus) PHP over (Rhino) JS. Personally I like both languages and I
can see advantages and disadvantages in both of them. Theoretically
Helma was able to be extended with different scripting languages for
years. But as far as I know, nobody ever did it. So the motivation was a
proof of concept of the the scripting engine interface of Helma. My
personal conclusion is, that the interface is at least good enough to
allow various scripting language plugins to be developed. It could
however be much better, if having a variety of different scripting
languages would be a goal. Learning were things can be enhanced was
another important motivation for writing the plugin.
Btw, these are some of my personal favorites of using PHP as scripting
language for Helma.
class HopObject {
public function size() {
return "overriding can be so damn easy " . HopObjectJava::size();
}
public function __get($name) {
return "generic getters and setters, finally!";
}
public function main_action() {
import java.util.Date;
echo new Date();
}
}
Kind regards,
Daniel
PS: Thanks for the pointer to script-10.jar! Only having resin-util.jar
is not enough, but the script-10.jar might have the missing things. I
will give it a try.
Maksim Lin for technical support mailling lists wrote:
> Hi Daniel,
>
> Thanks for the pointer to Quercus! - I didnt even realise there was a
> Java implementation of PHP.
> I'm not sure if I would use it to write PHP scripts inside my Helma
> apps, but its very cool how you've been able to integrate running php
> scripts directly and pretty cleanly within Helma!
> However I could see myself using Quercus as a way of running PHP apps
> alongside Helma apps...
>
> Also I notice you include the Resin.jar but in thier .war download, it
> only seems to depend on resin-util.jar and script-10.jar which are much
> smaller (643+27kb vs 8.9Mb) so perhaps you might be able to use that
> instead for your package?
>
> Maks.
>
>
>> -----Original Message-----
>> From: [email protected]
>> [mailto:[email protected]] On Behalf Of Daniel Ruthardt
>> Sent: Tuesday, 12 August 2008 00:58
>> To: Helma User Mailing List; Helma Developer Mailing List
>> Subject: [Helma-user] PHP scripting engine plugin v0.1
>>
>> Hi list,
>>
>> I've been working on a PHP scripting engine plugin for Helma
>> 1.x during the last two weeks.
>> Although not finished. complete, or completely tested yet, I
>> feel it is ready to be released to the public.
>> A sample application is included.
>>
>> The plugin is based on the Quercus PHP scripting engine [1]
>> by Caucho, which is part of the Resin [2] application server.
>> Caucho offers both a
>> GPLv2 and a commercial pro version. So far, the plugin makes
>> use of the
>> GPLv2 version only, which lacks Java bytecode compilation support.
>> Caucho claims, that the commercial pro version (which offers
>> Java bytecode compilation support is 4x faster than mod_php.
>> I did some small standalone (i.e. without Helma) tests, which
>> resulted in the pro version being at least twice as fast as
>> mod_php and sometimes even faster as compiled Rhino JS.
>>
>> You can download the plugin from [3]. The release file is
>> meant as overlay over a Helma 1.x (I only tested it with
>> Helma 1.6.2) distribution. So to test it, simply extract a
>> new Helma distribution [4] file and extract the plugin
>> release file over it. The plugin release file contains three
>> new libraries (quercus.jar, resin.jar and warp.jar), a test
>> application (welcomePhp), an internal database for the test
>> application (db/welcomePhp), static files for the test
>> application and most important a simple script to start Helma
>> (start_with_php.sh).
>>
>> IMPORTANT:
>> For some reason (still need to find out why), the plugin only
>> works when you start Helma like the included script file does
>> it (i.e. it does not work, if you start Helma with the
>> original start.sh script file which starts Helma via the
>> launcher.jar).
>>
>> About Warp:
>> Just to have it mentioned: the php plugin is hosted at Sourceforge.
>> Warp, the project under which it is hosted, is a (my) fork of
>> Helma 1.x.
>> The intention of the fork is to rewrite and extend a
>> pluggable Helma 1.x from the inside (compared to Helma NG).
>> The fork allows me to do that in a flexible and permissive
>> way. No need to look at the SVN yet, the current version does
>> not differ from Helma (except being reformatted a little
>> bit). Although it will soon differ substantially, it will
>> always remain compatible to Helma 1.x (including future
>> versions, at least that is the main goal). Additionally I
>> will always provide functionality as Helma 1.x plugins (like
>> the php plugin) too, if possible (if it is possible to have
>> such functionality as Helma plugin). What was known as Warp
>> before (the Warp repository implementation) [5] will soon be
>> rewritten and included in Warp.
>>
>> Kind regards,
>> Daniel
>>
>> [1] http://quercus.caucho.com/
>> [2] http://caucho.com/resin/
>> [3]
>> http://sourceforge.net/project/showfiles.php?group_id=235880&p
>> ackage_id=287402
>> [4] http://dev.helma.org/download/
>> [5] http://dev.helma.org/wiki/Related+Projects/#Warp
>> _______________________________________________
>> Helma-user mailing list
>> [email protected]
>> http://helma.org/mailman/listinfo/helma-user
>>
>>
> _______________________________________________
> Helma-user mailing list
> [email protected]
> http://helma.org/mailman/listinfo/helma-user
>
>
--------------000507000501030809080501
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Maks,<br>
<br>
Quercus is pretty much the best product I was able to find to connect
Java and PHP. Of course I do know, that native PHP is able to use Java,
but with Quercus its even easier to use Java from within PHP, but most
important the integration effectively works in both directions.<br>
After having finished the first release of the PHP plugin, I can judge
the Quercus engine as being quite easy to integrate in any Java
application. Especially extending the the PHP context with additional
modules (like the GlobalObject does it for JS) is extremely easy and
far more straightforward than what I could see how it is done for the
JS context.<br>
<br>
The motivation however of writing the plugin was not that I prefer
(Quercus) PHP over (Rhino) JS. Personally I like both languages and I
can see advantages and disadvantages in both of them. Theoretically
Helma was able to be extended with different scripting languages for
years. But as far as I know, nobody ever did it. So the motivation was
a proof of concept of the the scripting engine interface of Helma. My
personal conclusion is, that the interface is at least good enough to
allow various scripting language plugins to be developed. It could
however be much better, if having a variety of different scripting
languages would be a goal. Learning were things can be enhanced was
another important motivation for writing the plugin.<br>
<br>
Btw, these are some of my personal favorites of using PHP as scripting
language for Helma.<br>
<br>
class HopObject {<br>
public function size() {<br>
return "overriding can be so damn easy " . HopObjectJava::size();<br>
}<br>
<br>
public function __get($name) {<br>
return "generic getters and setters, finally!";<br>
}<br>
<br>
public function main_action() {<br>
import java.util.Date;<br>
echo new Date();<br>
}<br>
}<br>
<br>
Kind regards,<br>
Daniel<br>
<br>
PS: Thanks for the pointer to script-10.jar! Only having resin-util.jar
is not enough, but the script-10.jar might have the missing things. I
will give it a try.<br>
<br>
<br>
Maksim Lin for technical support mailling lists wrote:
<blockquote
cite="mid:[email protected]"
type="cite">
<pre wrap="">Hi Daniel,
Thanks for the pointer to Quercus! - I didnt even realise there was a
Java implementation of PHP.
I'm not sure if I would use it to write PHP scripts inside my Helma
apps, but its very cool how you've been able to integrate running php
scripts directly and pretty cleanly within Helma!
However I could see myself using Quercus as a way of running PHP apps
alongside Helma apps...
Also I notice you include the Resin.jar but in thier .war download, it
only seems to depend on resin-util.jar and script-10.jar which are much
smaller (643+27kb vs 8.9Mb) so perhaps you might be able to use that
instead for your package?
Maks.
</pre>
<blockquote type="cite">
<pre wrap="">-----Original Message-----
From: <a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
[<a class="moz-txt-link-freetext" href="mailto:[email protected]">mailto:[email protected]</a>] On Behalf Of Daniel Ruthardt
Sent: Tuesday, 12 August 2008 00:58
To: Helma User Mailing List; Helma Developer Mailing List
Subject: [Helma-user] PHP scripting engine plugin v0.1
Hi list,
I've been working on a PHP scripting engine plugin for Helma
1.x during the last two weeks.
Although not finished. complete, or completely tested yet, I
feel it is ready to be released to the public.
A sample application is included.
The plugin is based on the Quercus PHP scripting engine [1]
by Caucho, which is part of the Resin [2] application server.
Caucho offers both a
GPLv2 and a commercial pro version. So far, the plugin makes
use of the
GPLv2 version only, which lacks Java bytecode compilation support.
Caucho claims, that the commercial pro version (which offers
Java bytecode compilation support is 4x faster than mod_php.
I did some small standalone (i.e. without Helma) tests, which
resulted in the pro version being at least twice as fast as
mod_php and sometimes even faster as compiled Rhino JS.
You can download the plugin from [3]. The release file is
meant as overlay over a Helma 1.x (I only tested it with
Helma 1.6.2) distribution. So to test it, simply extract a
new Helma distribution [4] file and extract the plugin
release file over it. The plugin release file contains three
new libraries (quercus.jar, resin.jar and warp.jar), a test
application (welcomePhp), an internal database for the test
application (db/welcomePhp), static files for the test
application and most important a simple script to start Helma
(start_with_php.sh).
IMPORTANT:
For some reason (still need to find out why), the plugin only
works when you start Helma like the included script file does
it (i.e. it does not work, if you start Helma with the
original start.sh script file which starts Helma via the
launcher.jar).
About Warp:
Just to have it mentioned: the php plugin is hosted at Sourceforge.
Warp, the project under which it is hosted, is a (my) fork of
Helma 1.x.
The intention of the fork is to rewrite and extend a
pluggable Helma 1.x from the inside (compared to Helma NG).
The fork allows me to do that in a flexible and permissive
way. No need to look at the SVN yet, the current version does
not differ from Helma (except being reformatted a little
bit). Although it will soon differ substantially, it will
always remain compatible to Helma 1.x (including future
versions, at least that is the main goal). Additionally I
will always provide functionality as Helma 1.x plugins (like
the php plugin) too, if possible (if it is possible to have
such functionality as Helma plugin). What was known as Warp
before (the Warp repository implementation) [5] will soon be
rewritten and included in Warp.
Kind regards,
Daniel
[1] <a class="moz-txt-link-freetext" href="http://quercus.caucho.com/">http://quercus.caucho.com/</a>
[2] <a class="moz-txt-link-freetext" href="http://caucho.com/resin/">http://caucho.com/resin/</a>
[3]
<a class="moz-txt-link-freetext" href="http://sourceforge.net/project/showfiles.php?group_id=235880&p">http://sourceforge.net/project/showfiles.php?group_id=235880&p</a>
ackage_id=287402
[4] <a class="moz-txt-link-freetext" href="http://dev.helma.org/download/">http://dev.helma.org/download/</a>
[5] <a class="moz-txt-link-freetext" href="http://dev.helma.org/wiki/Related+Projects/#Warp">http://dev.helma.org/wiki/Related+Projects/#Warp</a>
_______________________________________________
Helma-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
<a class="moz-txt-link-freetext" href="http://helma.org/mailman/listinfo/helma-user">http://helma.org/mailman/listinfo/helma-user</a>
</pre>
</blockquote>
<pre wrap=""><!---->_______________________________________________
Helma-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
<a class="moz-txt-link-freetext" href="http://helma.org/mailman/listinfo/helma-user">http://helma.org/mailman/listinfo/helma-user</a>
</pre>
</blockquote>
</body>
</html>
--------------000507000501030809080501--
--===============1073615968==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Helma-user mailing list
[email protected]
http://helma.org/mailman/listinfo/helma-user
--===============1073615968==--