Last summer I put together a list of Options for using PHP with WebSphere. One of the approaches I mentioned, but didn’t elaborate on, was to use a PHP-Java bridge.
In the time since I wrote that post, and particularly in the past month, there have been several items published which demonstrate the value of this technology. I still need to delve deeper, but here’s a quick summary of what’s going on.
What it is
In essence, a PHP-Java bridge enables PHP developers to access Java code from within their applications and vice versa. The benefit is that you can reuse libraries or services deployed on one platform from code that exists in a different environment.
This differs from the standard approach of using an HTTP server front end to route individual requests for PHP scripts or J2EE applications. The PHP or Java application can instead call the other without the HTTP server’s involvement.
While you can always use Web service APIs to communicate between your applications over HTTP, PHP-Java bridges provide a method to access the external application’s API directly from the source code. As such, they are much more efficient than traditional network calls.
How it works
Implementations enable one or more of the following techniques:
- PHP running as a Web server module calls out to a servlet running on a J2EE application server.
- A servlet executes PHP scripts via CGI.
- PHP calls non-J2EE Java applications.
Where to get it
There are three major projects which implement this technology in varying degrees.
- The open source PHP/Java Bridge hosted at SourceForge.
- The commercial Zend Platform Java Bridge developed by Zend Technologies.
- The free PHP Integration Kit for WebSphere Application Server Community Edition.
Find out more
The well documented open source PHP/Java bridge appears to be the most mature technology at this point. You’ll find more information via the related links section of the project page.
IBM developerWorks has posted the first installment in a “Develop with Java and PHP technology on AIX Version 5.3” series on setting up the requisite software in a Unix environment.
There don’t seem to be many details available about the Zend Platform Java Bridge, but I’m hoping to learn more when/if Andi Gutmans posts his presentation from JavaOne that he described in this blog entry.
There’s also a “Caffeinated PHP, Integrating PHP and Java” Webinar tomorrow which will describe Zend’s offering.
I’m not sure of the roadmap for the PHP Integration Kit and it hasn’t moved much since being announced as an alphaWorks technology last year.