|
From: <php...@li...> - 2007-08-13 17:19:13
|
Hi .. I'm (primarily) a Java J2EE developer, working on a project to integrate JAAS security authentication with PHP authentication using WebSphere. Hope to produce a Drupal module if successful; time will tell. If things go well, one result will be some documentation of the process, necessarily limited by my understanding of the JavaBridge and PHP, both hopefully growing, and possibly a journal article or two. I've posted preliminaries of the first couple of steps as blog entries at http://dorsetwest.com (specifically http://www.dorsetwest.com/node/34). I'd be grateful for any review by more experienced users of the bridge, now and as this moves along so I can catch my errors and misunderstandings. In the comments that follow I'm using the August 7 build of JavaBridge. One understanding I'm trying to check relates to the purpose and use of the php_java.dll (which I think is what Jost means by the C-based extension module ... is this correct?) or alternately the "pure PHP PHP/Java Bridge classes" which I can't identify in code. Have I correctly identified the C-based extension? Where do the pure PHP PHP/Java Bridge classes reside, and are they PHP classes or Java Classes? I find, for example, that on a windows platform with: * No particular Apache extensions other than enabling PHP 5.2 (installed with MySQL and an image package only), * A JavaBridge servlet running on my WAS server, * Apache configured to route Java-bound URL's to the servlet engine by means of the WebSphere plugin, That an attempt to access a Java session from a PHP script residing entirely in the Apache home directory (invisible to servlet) works quite well so long as the critical include directly references the servlet, e.g. if(!extension_loaded('java')) require_once("http://localhost:9080/JavaBridge/java/Java.inc"); Does this mean: 1. Neither the C nor pure PHP extensions are needed any longer on the Apache/PHP side? I did see an "optional" post by Jost on this list, but wasn't sure what the effect of inclusion or non-inclusion at the Apache/PHP level had. I'm aware that the Java side is doing PHP work using its internal PHP interpreter 2. The C or PHP extensions are needed, and are included or referenced by some mechanism I haven't figured out yet, or 3. I'm missing a basic understanding? I do note that interpreting PHP through the bridge, e.g. running a PHP script that accesses a Java session, using the URI JavaBridge/myScript.php is very slow, e.g. 5seconds where JSP is about 1 second, but that running the same PHP script directly in Apache, even though it still references a java session (but only for a single call I think) is very fast, less than a second. I attribute that to the improved efficiency of the PHP/Apache collaboration and threading ... does that make sense? Would adding the C or Pure PHP classes affect these kinds of performance issues? Help is welcome ... I've got a few other questions, but will put them in another post for clarity. |
|
From: <php...@li...> - 2007-08-14 07:50:16
|
Hi,
> the php_java.dll (which I think is what Jost means by the C-based
> extension module ... is this correct?) or alternately the "pure PHP
The php_java.dll or java.so (Unix) is the Java.inc, compiled to native code, yes.
> PHP/Java Bridge classes" which I can't identify in code.
It will be created as java/Java.inc, if you run the test.sh or test.bat.
> correctly identified the C-based extension? Where do the pure PHP
> PHP/Java Bridge classes reside, and are they PHP classes or Java Classes?
Usually in the back end (in META-INF of JavaBridge.jar) or in the PHP include path.
[http front-end, j2ee back-end]
> That an attempt to access a Java session from a PHP script residing
> entirely in the Apache home directory (invisible to servlet) works quite
> well so long as the critical include directly references the servlet, e.g.
> 1. Neither the C nor pure PHP extensions are needed any longer on the
> Apache/PHP side?
If you want to allocate a session from the J2EE back end, you need to call java_session(). The
function is exported from Java.inc.
> I'm aware that the Java side is doing PHP work using its internal PHP
> interpreter
At the moment there is no Java-based PHP interpreter. *IF* we want to make use of
just in time compilation of PHP opcode, we *may* implement a translator. But there are
no immediate plans to write PHP in pure Java, yet.
> 3. I'm missing a basic understanding?
Well, the bridge is just an XML-based network protocol, which translates PHP/Java calls
into XML and then passes them to the back-end.
[running PHP as a FastCGI sub-process of the J2EE server]
> script that accesses a Java session, using the URI
> JavaBridge/myScript.php is very slow, e.g. 5seconds where JSP is about 1
On modern operating systems this shoudn't be much slower than JSP. However, there are
some older OS, which use Nagle's algorithm even for the local interface. This insane
setting can't be switched off in PHP, so we can't do anything to speed up round-trips
on this OS (BSD).
[running PHP within Apache]
> second, but that running the same PHP script directly in Apache, even
> though it still references a java session (but only for a single call I
In both cases it needs a round-trip through the back-end, so I don't know where
the delay comes from.
> improved efficiency of the PHP/Apache collaboration and threading ...
Not really. In most cases J2EE/FastCGI is as fast (or even faster) than Apache/PHP.
> does that make sense? Would adding the C or Pure PHP classes affect
> these kinds of performance issues?
No. -- Well, yes, if you don't have an PHP opcode cache. But this is true for any PHP code.
Regards,
Jost Boekemeier
Jetzt Mails schnell in einem Vorschaufenster überfliegen. Dies und viel mehr bietet das neue Yahoo! Mail - www.yahoo.de/mail
|