Using BIRT with PHP and php/Java bridge

As I promised some days before, here you get the tutorial of how to use BIRT, PHP, Zend Framework (ZF) and php/Java bridge (pJb).

Software requirements
I have tested the environment with:
* Zend Framework 1.0.1
* php/Java bridge 4.3.0
* BIRT 2.2.0
* PHP 5.2.1
* Ecw_Java_* classes version 1.0 (EcwJ)

I presume, you have already unpacked ZF. Unpack the EcwJ into the ZF library path (/library).
Unpack the directory ReportEngine from the BIRT package to a directory of your choice.
Create a directory called pJb. Extract the directory java from the JavaBridge.war (it is in the pJb package) into it. Extract /WEB-INF/lib/JavaBridge.jar into the /pjb directory.
Create the directories /pjb/lib and /pjb/srv

In the end you should have the following directory structure:


Create a batch or bash file /pjb/start-bridge.[bat|sh]. Use this content.


java.exe -Duser.home=$DIR_PJBsrv;$DIR_PJB JavaBridge.jar SERVLET:8080 5 php-java-brige.log


java -Duser.home=$DIR_PJB/srv;$DIR_PJB JavaBridge.jar SERVLET:8080 5 php-java-brige.log

Replace $DIR_PJB with your installation directory of pJb. The argument -Duser.home fixes a security hole version 4.3.0 of pJb contains.

You can now start the pJb with executing start-bridge.[bat|sh].
php-java-bridge.log should contain something like this:

Sep 23 19:57:40 JavaBridge INFO : VM                  : 1.6.0_02@
Sep 23 19:57:40 JavaBridge INFO : JavaBridge version             : 4.2.2
Sep 23 19:57:40 JavaBridge INFO : logFile             : php-java-brige.log
Sep 23 19:57:40 JavaBridge INFO : default logLevel    : 5
Sep 23 19:57:40 JavaBridge INFO : socket              : SERVLET:8080
Sep 23 19:57:40 JavaBridge INFO : java.ext.dirs       : C:ckldevlangjavadistjre1.6.0_02libext;C:WINDOWSSunJavalibext
Sep 23 19:57:40 JavaBridge INFO : C:ckldevprojectsweb200_VwpilotPRtrunkbinphp-java-bridgesrv;
Sep 23 19:57:40 JavaBridge INFO : extra library dir   : C:ckldevprojectsweb200_VwpilotPRtrunkbinphp-java-bridgesrv;
Sep 23 19:57:40 JavaBridge INFO : thread pool size    : 20
Sep 23 19:57:40 JavaBridge INFO : JavaBridgeRunner started on port INET:8080

Set the environment variable BIRT_HOME to the direcoty of your ReportEngine.


set BIRT_HOME=$DIR_BIRT/ReportEngine


export BIRT_HOME=$DIR_BIRT/ReportEngine

Replace $DIR_BIRT with your installation path of BIRT.

First steps in PHP
Copy the following content to a ZF controller of your choice:


$report = new Ecw_Java_Reporting_Birt_Pdf("$DIR_RE");

Replace $SERVER_URL with the address of pJb instance. This should be http://localhost:8080/JavaBridge/java/
Replace $DIR_RE with the BIRT ReportEngine directory.

Execute the controller in your browser and you should see a hello_world.pdf in $DIR_BIRT/samples directory.

Comments ( 2 )

  1. / ReplyRoger Hunwicks
    Thank you for these posts, they are very interesting. I have just started looking at using the php-java bridge as an alternative to Zend Platform for running BIRT reports on PHP. Would you be happy to share your ecw_java classes? Are they available for download anywhere? Thanks, Roger
  2. / ReplyAnonymous
    Hello Roger, I have published the wrapper classes under [url][/url]. Christopher

Leave a reply

Your email address will not be published.

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>