Monthly Archives: November 2009

Seagull in Florida

Seagull in Florida

Florida West Coast (2007) - having fun with the birdies


Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial 2.0 Belgium License.

PHP/Java bridge

I have recently tried the PHP/Java bridge and I must say I was pleasantly surprised. Installation took only 5 minutes and it works like a charme. The examples bundled with the application show some very nice usage examples.

Just a few things I noticed :

  • In Tomcat 5, the bridge doesn’t seem too stable. In some situations (exceptions), the Tomcat server just shuts down. I have upgraded to Tomcat 6 and the problem hasn’t occured since.
  • If you run your PHP code in apache, and Java in Tomcat, you could encounter the problem that the Java.inc file cannot be included :
    require_once('http://tomcatserver:port/bridge/java/Java.inc');
    because the ‘allow_url_include‘ setting is disabled in PHP. I solved this by copying the Java.inc and JavaProxy.php files to the PHP server, including them the usual way :
    require_once('./java/Java.inc');
    You can then set the location of the java bridge in your PHP code :

    define('JAVA_HOSTS', 'localhost:8090');
    define('JAVA_SERVLET', "JavaBridge");