Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have a Java web application deployed on Tomcat. We also setup Apache and mod_proxy_ajp to route web requests (port 80/443) to Tomcat.

We would like to deploy a PHP application on the same Apache server - probably under a subdirectory (/var/www/ourapp).

Now we would like to access & display web pages from PHP application within web pages generated by Java application. Planning to implement Single Sign-on as well. Example: Web page from java has (JQuery Tabs) and we like to display the PHP web page within a tab while all other HTML comes from java application.

Can you please give a overall picture of how to proceed about this? Mainly 1. how we should install/setup our PHP application on same Apache server which is used to route web requests to Tomcat? i.e. either setup sub domain or install in sub directory 2. How to bring PHP pages into present web pages (generated by java). Can we use AJAX requests or should go for Java PHP Bridge/ Querces such applications?

Thank you for your time in advance. Regards.

share|improve this question
up vote 0 down vote accepted

The AJP proxy should only take requests that are defined in your AJP conf file and forward those requests to Tomcat, that's what a proxy does.

So in other words when a request comes in for index.jsp for instance, the file *.jsp is configured to be sent over AJP. At that point Apache opens a connection and sends an AJP request to Tomcat which then renders and returns the index.jsp file, Apache then simply streams it to the client.

If PHP runs on the Apache server and you have not forced all requests to go to Tomcat any request for index.php should simply be returned by your Apache server. So as far as your Java app is concerned a request for index.php is not something it is concerned with loading, depending on your implementation of course. If you are simply using jQuery loading methods the client will make the call for the PHP application which Apache would then render. Regardless, there is not much, if anything you have to do other than check your AJP conf files.

share|improve this answer
Thank you for your response. I will verify AJP conf files and check if all requests are forced to send to tomcat. – Venkat Oct 2 '12 at 9:48
Hi, you are right. We were forcing all requests to reach Tomcat server using / (root path). After replacing it with appropriate context paths, then its working. Thank you very much. – Venkat Oct 5 '12 at 18:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.