1. Enable php support in tomcat.
a. Deploy JavaBridgeTemplate713.war package in tomcat
b. After deployment stop the tomcat.
c. copy the $CATALINA_HOME/webapps/JavaBridgeTemplate713/WEB-INF/lib/php-servlet.jar $CATALINA_HOME:/project/apache-tomcat-7.0.57/lib/
and $CATALINA_HOME/webapps/JavaBridgeTemplate713/WEB-INF/lib/JavaBridge.jar $CATALINA_HOME:/project/apache-tomcat-7.0.57/lib/
d. Add the following lines in web.xml to enable php support.
<!--- ======================================================================= -->
<listener><listener-class>php.java.servlet.ContextLoaderListener</listener-class></listener>
<servlet><servlet-name>PhpJavaServlet</servlet-name><servlet-class>php.java.servlet.PhpJavaServlet</servlet-class>
</servlet>
<servlet><servlet-name>PhpCGIServlet</servlet-name><servlet-class>php.java.servlet.fastcgi.FastCGIServlet</servlet-class>
<init-param><param-name>prefer_system_php_exec</param-name><param-value>On</param-value></init-param>
<init-param><param-name>php_include_java</param-name><param-value>Off</param-value></init-param>
</servlet>
<servlet-mapping><servlet-name>PhpJavaServlet</servlet-name><url-pattern>*.phpjavabridge</url-pattern> </servlet-mapping>
<servlet-mapping><servlet-name>PhpCGIServlet</servlet-name><url-pattern>*.php</url-pattern></servlet-mapping>
<!--- ======================================================================= -->
2. Change the document root of tomcat pointing to the application.
a. Deploy the application(test-app) , it will create a dirwctory $CATALINA_HOME/webapps/test-app
b. change in server.xml. Add the following line.
<Context path="" docBase="webcontent" debug="0" reloadable="true"></Context>
3. Add the index.php as aditional index file in tomcat.
Add the following line in conf/web.xml in <welcome-file-list> section
<welcome-file>index.php</welcome-file>
4. Auto redirection from 80 to 8080 (http to tomcat)
Create a new file /etc/httpd/conf.d/proxy.conf with the following content.
NameVirtualHost *:80
<VirtualHost *:80>
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Deny from all
Allow from all
</Proxy>
RewriteEngine on
ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/
</VirtualHost>