JSP / Servlet - PHP Integration Options

By Angsuman Chakraborty, Gaea News Network
Wednesday, May 10, 2006

There are four different integration options in order of complexity and your requirements. They are as follows:

Multi-port Integration
Run Apache (with PHP) on default port 80 and Tomcat on default port (8080). They can run on the same machine with different ports without any problems whatsoever. This is the simplest procedure.

Single Port Integration (Apache Mapping)
In this scenario Apache and Tomcat runs on different ports as above. However Tomcat any application can be mapped to a path on Apache server. So it doesn’t appear to the end user that two servers are running. This is almost as simple as sbove.

Running PHP 5.x in Tomcat
The link above provides a detailed tutorial along with helpful comments from users. This isn’t very complex to setup (more complex than above) but you have to carefully follow the steps. This also allows invoking php code from within jsp and with some minor changes in reverse direction too.

Single Port Integration (Apache Tomcat Connector)
This is slightly better than the Apache mapping solution above. You can configure it to run static html pages in Apache and dynamic JSP pages using Tomcat. However it is a installation / configuration hell (almost).

For all of the above you can exchange data between the PHP and Tomcat by using the database, files, invoking appropriate URL with GET/POST data etc. Additionally you can directly communicate in the
running PHP 5.x in Tomcat solution.

Discussion

kn
August 10, 2008: 10:05 pm

Servlet php is not available Error is coming


bala

jclabu
November 9, 2006: 9:33 pm

Hi,

I’m do programming in jsp (in my site) which is need to invoke another URL/site which use PHP. The problem is I don’t know how to INVOKE in JSP.
Exp:
mysite
https://abc.com/index.jsp

phpsite
https://def.com/index.php

from mysite i need to passing parameter to the phpsite and then get back the response/parameter from the phpsite. In this situasion on phpsite was not allow to send redirect. The only way is to INVOKE that page.

Anyone have the idea please share with me to solve this problem.

Thanks,

jclabu.

YOUR VIEW POINT
NAME : (REQUIRED)
MAIL : (REQUIRED)
will not be displayed
WEBSITE : (OPTIONAL)
YOUR
COMMENT :