Installing PHP/Java Bridge




The J2EE interface associates a PHP web context or the entire J2EE

server with a managed and persistent PHP executable or an external

HTTP server running PHP.


This document describes how to call Java methods from PHP. And how to

embed PHP applications into a pure Java application server or servlet

engine. Please see the INSTALL.J2SE document for details how to call

PHP methods from a pure Java application.







  • Install a J2EE application server or servlet engine, for example Apache Geronimo, Tomcat, Glassfish, ...


  • Copy your Java libraries, PHP executables or PHP libraries into JavaBridgeTemplate.war and rename it to "myPhpApp.war" or similar.


  • Copy your web application myPhpApp.war to the autodeploy folder of your J2EE server or servlet engine. If you don't have a myPhpApp.war yet, simply rename "JavaBridge.war" to "myPhpApp.war".


  Example for Tomcat on Unix:

  cp myPhpApp.war $CATALINA_HOME/webapps/


 Example for Apache Geronimo on Windows:

 copy myPhpApp.war "\Program Files\IBM\WebSphereCommunityEdition\deploy"


  Wait until the "myPhpApp" directory appears (restart your J2EE

  server, if necessary).



  •  If you want to run PHP as a sub component of Apache or IIS or from the command line, require() directly from the back end.

  Or embed it into your PHP application and use the provided Java class as usual.


  • Firewall-out the J2EE/Servlet port 8080, if necessary. Or modify the J2EE/Servlet so that it listens only on the local interface. Note that in the default setup the PHP/Java Bridge rejects requests from non-local PHP clients. For a intranet server start the J2EE/Servlet VM with the parameter or set the "promiscuous" init-param in the J2EE WEB-INF/web.xml and make sure that your computer cannot be accessed from the internet. At least firewall-out the ports 8080 and all ports in the range [9267,...,[9367 and read the "security" sections from README.

Post new comment

The content of this field is kept private and will not be shown publicly.