Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

How can Java and PHP work together?

Options
  • 28-06-2011 5:12pm
    #1
    Registered Users Posts: 19,019 ✭✭✭✭


    Hi all,
    I've been asked to switch to another brand new project in our company and all I know is that it'll be some sort of Hotel booking portal jobbie which combines Java and PHP.

    How might that work in the real world and what benefits might it bring over a pure Java or pure PHP application? I googled things like "Java and PHP integration" etc. and I immediately get heavy going technical content....I'm just looking for a rough overview of what/why/how etc.

    (I will be working on the frontend, but I like to know more than just that)

    Cheers for any discussion!


Comments

  • Moderators, Society & Culture Moderators Posts: 9,689 Mod ✭✭✭✭stevenmu


    Just a guess, it's probably PHP on the server generating pages with Javascript running client-side?


  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    Hard to say really. Perhaps the business front-end is a Java Client and perhaps the web, i.e. customer frontend is a PHP one.

    Or they have a 3rd-party booking system which is Java-based, but the hotel's client is PHP based, so you make SOAP calls from the PHP client to the Java backend.

    The latter is the scenario where I most often encounter any kind of Java & PHP "combination".


  • Registered Users Posts: 19,019 ✭✭✭✭murphaph


    stevenmu wrote: »
    Just a guess, it's probably PHP on the server generating pages with Javascript running client-side?
    Hi Steven. It's actually Java, not Javascript. Both PHP and Java will be running on the server(s).

    My current project involves a Zend framework based backend and Yii framework based frontend with a JSON based web service between them.

    Hey Seamus, sounds more like something you might do if you have a set of existing applications that somewhat restrict your freedom. Do you know or can you think of any situation where you'd start with a blank canvas (I've been told that this is a brand new project and that absolutely no code exists yet) and select a combination of Java and PHP?


  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    Probably :)

    For example, you have a new project which involves a JSON/SOAP/AJAX web service setup, running on a central server, where the web client software needs to be portable and scalable (e.g. to roll out to regional offices or client sites).

    For the central service, you might build it on a Java architecture to leverage the vast libraries and functionalities therein, but the web client software in PHP would be easy to configure and roll out, and would have much smaller demands in terms of software and hardware. If you've ever installed PHP software, it's usually as simple as copying the files in, running an install script which takes a few variables and then configures the entire software setup. A Java-based client could probably be written to do the same thing, but the IT requirements to get it there in the first place would be higher.

    PHP developers are also more available than Java developers, so it works out cheaper and quicker to build the easier part of the system (the web client) in PHP and save the chunkier, more complicated stuff for Java.


  • Registered Users Posts: 83 ✭✭fatlog


    There is a version of PHP that has been built to run on the JVM. I doubt this would be what you will be working with as I didn't think this was at a production level...

    http://www.infoq.com/news/2007/10/php-java-stack
    http://rochakchauhan.com/blog/2008/01/09/now-jvm-for-php-sun-into-scripting-language-interpretation/

    There are all sorts of things going on with PHP at the moment. Facebook for example have their own version which they claim is faster.


  • Advertisement
  • Registered Users Posts: 3,140 ✭✭✭ocallagh


    fatlog wrote: »
    Facebook for example have their own version which they claim is faster.

    Facebook use (and I think wrote) HipHop which translates PHP into compiled C++ code which offers them cheap development/fast execution.

    http://developers.facebook.com/blog/post/358/

    It is available to download too https://github.com/facebook/hiphop-php


Advertisement