Integrate PHP, JasperReports, and Apache Tomcat 6

2019-08-10 00:54发布

问题:

I cannot make PHP & JasperReports work on Tomcat 6.

I have xampp (apache, php5.3.1, mysql, tomcat6) on Windows XP.

I followed the steps to install the php-java bridge, but PHP pages throw error.

Does someone have successfully integrate php, php-java bridge, JasperReports?

Can this be done without Apache Tomcat?

回答1:

Background

PHP and Java are different programming languages. They require the PHP/Java Bridge to connect.

Apache Tomcat and JasperReports are Java-based technologies. They connect naturally.

Apache HTTP Server, on the other hand, has a PHP integration.

Architectures

PHP

If you have a PHP infrastructure, then the easiest solution is the following:

  1. Install Apache HTTP Server.
  2. Install PHP.
  3. Install the latest Java Runtime Environment.
  4. Install the PHP/Java Bridge.
  5. Run Apache, PHP, and the PHP/Java Bridge.
  6. Include the PHP/Java Bridge headers in your PHP file.
  7. Call the JasperReports API from PHP.
  8. Execute reports.

This is a cumbersome and technically complex solution. Using Apache Tomcat instead of Apache HTTP Server will just add to the complexity because you will need a way to integrate PHP as well.

Java

If you can forego PHP and use straight Java, I would recommend JavaServer Pages (JSPs). The integration becomes:

  1. Install the latest Java Runtime Environment.
  2. Install Apache Tomcat.
  3. Call the JasperReports API from JSP.
  4. Execute reports.

Diagram



回答2:

Yes, it can be done without Tomcat. You have to run JRE on background.

See this link for further information.