October 2011
« Sep   Nov »

How do I run php on Java hosting environment

I got a requirement to run a php chat software running under java hosting environment.

What my server configuration is,

Primary web server : Apache with Mod_ajp connector running on port 80
Java application server : tomcat running on port 8080

So I want to install php application like this

There is a two way to solve this.

1. Disable the JK mount point on this folder (recommended)
2. Deny the proxy location request to php location

The first solution I uses the Apache +AJP connect to run the java application by mapping webapps location (check this link to how to enable AJP connector in Apache). So my Apache virtualhost entry will be

Solution 1: If you are using mod_ajp connector
You may need to specify “no-jk” option to identify the location where mod_jk will not managed.

Here is my Eg.
SetEnvIf Request_URI “/livechat/☆” no-jk

This shows all the access to this location(livechat) will not handled by mod_ajp connector and hence apache server it. Don’t forget to set the alias Alias /livechat /opt/jva_user/livechat

My virtual host entry is,

Solution 2: If you are using mod_proxy

We need to set a filter to block the access to specified location which would propose to serve Apache.

  ProxyPass /livechat !

My Virtualhost entry which using proxy module looks like,

Don’t forget to set Alias folder mapping to Apache web location. Also using proxy module in Apache is not a recommended method for mission critical web servers

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>