PHP/Java Bridge settings

The PHP/Java Bridge web application contains two servlets. The PhpJavaServlet handles requests from remote PHP scripts running in Apache/IIS or from the command line. The second servlet PhpCGIServlet can handle requests from internet clients directly.

The following shows the settings of the PhpJavaServlet and the PhpCGIServlet.


The PhpJavaServlet handles requests from PHP clients.

Apache/IIS/console::PHP <--> PhpJavaServlet
It listens for PHP/Java Bridge protocol requests on the local interface or on all available network interfaces and invokes Java methods or procedures. The following example accesses the bridge listening on the local interface:
$System = java("java.lang.System");
echo $System->getProperties();

Option Value Description
servlet_log_level 3 The request log level.


The PhpCGIServlet runs PHP scripts within the J2EE/Servlet engine.

internet browser <--> PhpCGIServlet <--> php-cgi <--> PhpJavaServlet

It starts a PHP FastCGI server, if possible and necessary. Requests for PHP scripts are delegated to the FastCGI server. If the PHP code contains Java calls, the PHP/Java Bridge protocol requests are delegated back to the current VM, to an instance of the PhpJavaServlet.

Option Value Description
php_exec php-cgi The name and location of your system_php_exec. For example /opt/PHP/bin/php-cgi. Default is /usr/bin/php-cgi or c:/Program Files/PHP/php-cgi.exe or a php-cgi from the PATH.
prefer_system_php_exec Off Ignore a local WEB-INF/cgi/php-cgi-ARCH-OS executable from the web archive and use the specified php_exec. Default is Off.
php_include_java Off Shall the server add <?php include_once("java/");?> at the top of each PHP script? Default is Off.

The settings were taken from the WEB-INF/web.xml.