One of the first articles I wrote for the ColdFusion Developer's Journal was about setting up IIS to run on ColdFusion 5, ColdFusion MX, and BlueDragon. This was an article I co-wrote with my friend Charlie Arehart and it was published back in 2003. My intent was to write code once, and be able to test it on different application servers. This worked pretty well.

Nowdays I primarily use Apache Web Server for development purposes instead of IIS. ColdFusion has increased multiple version numbers. The need from the original article still exists. I currently do work on sites that use both ColdFusion 10 and ColdFusion 11. It'd be nice to be able to run both versions of ColdFusion side by side.

This article details how I set up my machine.

Installing ColdFusion

I already have CF10 installed on my machine, but need CF11. My first step was to download the ColdFusion 11 Developer Edition from the Adobe web site and follow the normal install instructions. You could install the EAR/WAR version of CF11 and deploy that using the CF10 instance manager. This is like running CF11 inside CF10. However, I decided to install CF11 in the server configuration mode; similar to how CF10 was previously installed.

During the install, you are given the option to configure your web server. Create a copy of your Apache Web Server conf directory and have the CF11 installer configure that copy. Then you can compare the two configurations to see what has changed. I was hoping that I would be able to make use of virtual servers, attach CF10 to some virtual servers, and CF11 to others. Unfortunately that is not possible.

The Problem

ColdFusion 10 and 11 both use Tomcat under the hood; a change since they have been using JRUN since CFMX when I wrote my initial article. In Apache, the JkShmFile directive is used to associate Apache with Tomcat servlet container. Unfortunately, only one JkShmFile directive can be in an Apache Web Server config; making it impossible to point different virtual servers in the same Apache instance to different versions of ColdFusion.

My Solution

I decided that I could use the same Apache installation with completely different configurations, one pointed at CF10 and one pointed at CF11. I wouldn't be able to run them at the same time unless I gave them different web server ports, but I would be able to do testing against different versions of ColdFusion. I decided this was suitable for my current needs.

This is how to run Apache from the command line and specify your custom config directory

view plain print about
1[Apache Install Directory]\bin\httpd -k start -f "[Config Directory\httpd.conf"

The K parameter is used to start, restart, or stop the Apache Web Server depending of the value of the parameter. The f parameter specifies the location of the config file. The f parameter is key to launching Apache with different configs.

I did some testing with this and determined it was working great. But, I wanted to set it up as a service so it would show up in the control panel on my Windows machine. This command did that:

view plain print about
1httpd -k install -n "MyServiceName" -f "[Config Directory\httpd.conf \httpd.conf"

Final Thoughts

Although I didn't take it this far, I could have shared a lot of configuration variables between the two servers through the use of Apache includes. That could be the topic of another article, though.

Sign up for DotComIt's Monthly Technical Newsletter