Integrating PHP/ASP/Ruby-Web-Applications with Pentaho Reporting

From time to time we get the same question on the Pentaho Reporting Forum:
“How do I integrate the Pentaho Bi-Server and reporting capabilities with my own (PHP/ASP/JSP/Ruby/whatever-) web-application?” Thrilled by the BI-Server’s blazing features, many users want to enrich their applications with rich reporting and analysis capabilities, and unlike the dinosaurs of the BI-Market, our Open-Source solution makes this easy and cost effective.

The techniques I am going to describe in this blog-post are no magic and can be applied to other web-application (like our Data-Integration server) as well.

First, you need to get a Pentaho system up and running. For now, and for the sake of easiness, lets stick with the standard Pre-Configured Installation (PCI). The Pentaho PCI is a Apache Tomcat server that runs the Pentaho BI-Server as its only web-application.

Installing the Pentaho BI-Server

  1. Download Pentaho
  2. Unpack the ZIP or tar.gz archive into a directory. On Linux or Unix systems, I would recommend something like “/opt” or “/usr/local/” as target. On Windows .. well, in that case you are just experimenting and not planing for production, I assume. So any folder will do.
  3. Setup a publish password

    You need that later for publishing reports or other files to the server. This is the major obstacle for most new users when trying to get their own content up and running.

  4. Edit the file “bi-server-ce/tomcat/webapps/pentaho/WEB-INF/web.xml”

    Change the parameter “fully-qualified-server-url” to the public URL of your server.

    
    
      fully-qualified-server-url
      http://localhost:8080/pentaho/
    
    
  5. Optional: If some other tomcat installation runs on your system, your port 8080 may be in use already.

    You can change the port in the file “bi-server-ce/tomcat/conf/server.xml”:

  6. Start the Hypersonic database
  7. Start the Pentaho BI-server
  8. Optional: Install the BI-Server as a system service.

You should now be able to direct your web-browser to the BI-Server and should see the login screen when you type http://localhost:8080/ into your browser’s address bar.

Integration by Direct Linking

Integrating a BI-Server into a existing PHP application is easy now. All you need is a running BI-Server instance that is accessible by your users. From now on, I will simply use the Pentaho Demo Server for our little integration project.

http://demo.pentaho.com

The Pentaho Demo Server is a slightly tuned down installation of the Pentaho BI-Server. Anything I am going to show will work in the same way with the standard community edition.

When refering to the two applications, I will use “application” for the PHP, ASP or Ruby application that wants to utilize the Pentaho Platform. I will use the term “Pentaho” for the Pentaho BI-Server.

The most primitive way of connection two web applications together is to make the application include Pentaho in an frame or by opening up the specific report or analysis view in a new window.


  
    
  
  
    

    This file could have been generated by any server side program. Use your phantasy here.    

   

    Reports can be parametrized by adding the parameters for the report to the URL. The parameters must be properly URL encoded. Use UTF-8 as character encoding.    

   

    This shows how to open up a report in a new Window:          A report    

     

Inside the Pentaho Platform, each report has its own page that can be accessed independently of the Pentaho User Console. The sample above links to a report on the system, using the predefined username and password. Note that the username and password is given in cleartext. To make this more secure you will need to set up a Single-Sign-On solution.

Pentaho Enterprise Edition comes with support for setting up Single-Sign-On for CAS rather easily via some setup scripts that take care of the ugly work. If you are using community edition and are willing to spend the time, you can always set it up yourself.

Alternatively you can set up Pentaho to work with Active Directory or LDAP instead.

Here are some sites with documentation to get you started.

And don’t forget: The Pentaho Wiki also contains a load of information.

Internally, Pentaho uses Spring Security, so with enough time and patience you should be able to connect Pentaho to anything on this planet for authentication purposes.

5 thoughts on “Integrating PHP/ASP/Ruby-Web-Applications with Pentaho Reporting

  1. Rodrigo Haces

    About the security of passwords, a good approach would also be to set the IP address of the webserver (where php or other is running)as a TrustedIP in the web.xml file. That will allow connections to Pentaho from the application only passing username.

    Reply
  2. KIRAN

    but when i click on a href the ip will be of the client who is accesing the system . correct ? is there any way to authenticate ? other than sending the user name and password ?

    Reply
  3. Thomas Morgner

    Pentaho comes with a fairly advanced authentication framework (Spring Security) which can be configured and/or extended to use 3rd party software as authentication source.

    http://static.springsource.org/spring-security/site/start-here.html

    Alternatively, you could write a small proxy script in your frontend, so that users do not talk to the pentaho server directly. All traffic is routed through your proxy. Configure the Platforms “Base-URL” properly to point to your proxy-script. Then your proxy script would be responsible for all security, while your Pentaho installation has the IP-Address(es) of your server-frontend as TrustedIP to bypass all security inside the Pentaho Platform. This is the model Roger Haces talks about in the previous comment.

    Reply
    1. bin lin

      I tried it on Pentaho 4.5. Iframe works for analyzer report and dashboard but doesn’t work for reportviewer. It seems to be cross domain issue.

      I set my front end php server to be a proxy which is supposed to solve cross domain issue. However it still didn’t work

      Reply
  4. John Flank

    I tried (Rodrigo Haces method by) adding IP address of my desktop machine into “Proxy Trusting Filter” section in web.xml file under \pentaho\web-inf\ folder, something like below, however it still asked my pentaho userid and password on user console screen after I just defined userid=joe as part of my parameter in the url, please shed some light.

    Proxy Trusting Filter
    org.pentaho.platform.web.http.filters.ProxyTrustingFilter

    TrustedIpAddrs
    127.0.0.1,myIPaddress,0\:0\:0\:0\:0\:0\:0\:1(%.+)*$
    Comma separated list of IP addresses of a trusted hosts.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

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>