views:

52

answers:

3

I need PHP for UI coding and I'll be making AJAX requests to a Java backend. I've never deployed two servers before. I'll need Apache for PHP and Tomcat for Java.

How can I do this?

+1  A: 

You can run php through Tomcat as it is based on Apache. Here is a pretty simple tutorial to do so. http://nexus.zteo.com/2008/02/15/how-to-setup-php5-with-tomcat-5/

RHicke
A: 

Well you can run both servers seperately but that would mean, that Tomcat will have to run on another port. You can also setup PHP with Tomcat as a CGI Script as already mentioned but I don't know if that'll offer the best performance.

In my experience the best way is to connect Tomcat with Apache is via mod_jk conenctor. You just have to tell Apache which pages to redirect to the Tomcat Server running behind it. Since you didn't give more information about your system environment I could only give you the link to the general documentation.

Daff
A: 

One possibility is to run a PHP interpreter written in Java directly in Tomcat and there is an open-source one called Quercus.

DigitalRoss