Skip to content

The Java PHP Connection

by Jeff

The JDJ* recently ran an article about Java-PHP Bridge projects – this is not 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. Here are the big three:

  • PHP/Java Bridge

    The php/Java bridge is an optimized, XML-based network protocol, which can be used to connect a native script engine, PHP, with a Java or ECMA 335 virtual machine. It is more than 50 times faster than local RPC via SOAP, requires less resources on the web-server side, and it is faster and more reliable than communication via the Java Native Interface. read more…

  • Zend’s Java Bridge

    The Zend Platform Java Bridge is the leading performance and reliability solution for businesses that seek to utilize both PHP and Java/J2EE. Based on a unique design that allows for a single Java Virtual Machine (JVM) instantiation and direct calls from PHP, the Java Bridge delivers unprecedented performance and scalability that make true PHP and Java integration a reality.Zend Java Bridge

  • AlphaWorks WAS Integration

    PHP Integration Kit for WebSphere® Application Server (WAS), Community Edition (CE), allows users to integrate PHP-based scripting into their Java™ 2 Enterprise Edition (J2EE) applications. Integrating these technologies gives programmers the advantages of both PHP and Java, providing greater flexibility in deploying dynamic applications, building Web front ends, and creating development projects.

    The PHP Integration Kit provides a sample Web application that can contain Java resources (JSPs and servlets, as with any J2EE Web application) as well as PHP scripts. The sample application is preconfigured to forward each PHP request to a separate PHP run-time environment, which then executes the requested PHP script. Users can then manage the combined Java/PHP application as a single unit within WAS CE: Users can deploy and undeploy the application using the WAS CE administration console and can apply security constraints to both Java and PHP resources using the J2EE security model.

In my mind this makes a lot of sense. The Java web development experience is cumbersome, tedious, and extremely heavyweight.

*I’m not going to provide a link to the article because the JDJ site is too full of ads.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

3 Comments

  1. eokuwwy wrote:

    I say just pick one or the other. It’s going to be hard to operate in two very different languages. What? PHP has objects you say? Yeah fine, but it’s not the core of the language. It’s not like C# and Java where everything is very similar. PHP is very loose, where as the Java compiler doesn’t let you do anything without explicitly stating exactly what you are doing. That means you have to work in two totally different mindsets if you are alone. If you have a separate developer or team for front end only and they only know PHP, then fine go ahead.

    Java front-end web development is a pain, but it is getting better. JSF is a strong step in the right direction. There are some AJAX API’s available, such as the GWT and Echo2, which don’t require you to code JavaScript. Eventually front end development in Java will be a breeze, though still bulky and overweight I’m sure.

    I just can’t see the need to bridge Java and PHP. How does debugging work? PHP’s error handling is about as useful as a dead cow’s nipple.

    Wednesday, June 27, 2007 at 11:03 am | Permalink
  2. eceppda wrote:

    Don’t hold back man, what do you really think?
    There are a lot of great web apps written in PHP. CMS, Blogs, Project Management software, etc; the best are in PHP right now.
    So what if you want to make use of a great webapp, but you want to draw on the data or provide more from a java legacy system?
    Or let’s say you want to write a web frontend for an existing app in Java. You could start with any number of Java web frameworks and devote the next 36 months building it brick by brick and documenting every detail in any number of configuration xml files… or you could put something together in PHP in about a fifth of the time, and keep it decoupled from the backend using the bridge.
    I think there is a use for the bridge.

    Wednesday, June 27, 2007 at 11:16 am | Permalink
  3. eokuwwy wrote:

    36 months? Only if you and your team are a bunch of total tools. It may be the heaviest for Web front-ends, but it doesn’t add that much time, if any. In the end, you should be able to make a better quality product anyway. Especially since you can easily debug it and unit test the hell out of it with J-unit. But hey, do your thing man, I’m just saying, if I were doing it myself, no way would I mix the two.

    I thought about it too for a client recently, and eventually decided against it for many reasons. The biggest issue was that for this particular client, it would mean the addition of another Web server, another platform, and added complexity for this client. Instead of having a system built on one platform, they would have two. Two languages that are not similar, and generally aren’t used for the same things. This would make it hard for the client to maintain the two systems by themselves in the future, having to find someone who knows PHP and Java.

    BTW, once you get used to it, JSP is pretty friggin easy to work with. And I never mentioned using any frameworks; you’ll have all the xml files on the back-end with whatever tools you’re using there.

    As for your smart-ass comment about not holding back, I believe I’ve already told you what I really think. If that was in reference to the dead cow statement, I thought people around here could handle a little quirky humor. Perhaps I am wrong.

    “CMS, Blogs, Project Management software, etc; the best are in PHP right now”

    Now THAT is funny!

    Sunday, July 1, 2007 at 11:00 pm | Permalink

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*