NO MORE WAR – Run CF7 and CF8 Together with Apache

I’ve seen a few articles for setting up Coldfusion 7 and 8 simultaneously using the instance manager and deploying a WAR file.

I had heard it was possible to do it with both versions of CF in standalone mode. However, I wasn’t able to find any documentation on it.

Work has me developing with Apache on an XP machine. And here we go…

Make sure you install each Coldfusion version to its own directory. For the purpose of this guide I have CF7 installed to c:coldfusion7 and CF8 to c:coldfusion8.

It doesn’t matter which one was installed first, just remember when you are installing them you are using standalone mode, with the built in server. DO NOT ASSIGN or CONNECT to a Web Server. This prevents CF from updating your Apache config file.

** If you are already running a version of CF, you will only be installing the other version, and you don’t have to worry that its already connected. Just be sure not to connect the new install, and skip the next Connector step below. **

Once you have both versions of Coldfusion installed, the next step is to connect Apache. You can use the Web Server Configuration Tool from the Start Menu, or by running wsconfig.exe in the c:coldfusion#runtimebin folder. Do this for only one of the versions of CF, as doing it for both will overwrite the others’ changes.

When it completes, open your Apache config file (httpd.conf) and look for a block of code like this:


LoadModule jrun_module "C:/coldfusion/runtime/lib/wsconfig/1/mod_jrun20.so"

JRunConfig Verbose false
JRunConfig Apialloc false
JRunConfig Ssl false
JRunConfig Ignoresuffixmap false
JRunConfig Serverstore "C:/opt/coldfusion/runtime/lib/wsconfig/1/jrunserver.store"
JRunConfig Bootstrap 127.0.0.1:51011
#JRunConfig Errorurl
#JRunConfig ProxyRetryInterval 600
#JRunConfig ConnectTimeout 15
#JRunConfig RecvTimeout 300
#JRunConfig SendTimeout 15
AddHandler jrun-handler .jsp .jws .cfm .cfml .cfc .cfr .cfswf

Keep in mind, what you see above is the default settings for your Apache Server. So if you connected CF7 then that would be your default CF version for all your current virtual hosts, unless you specify otherwise.

Which is the next step. Update your virtual host settings.



ServerName cf8testsite.local
DocumentRoot C:wwwrootcf8testsite
JRunConfig Serverstore "C:/coldfusion8/runtime/lib/wsconfig/1/jrunserver.store"
JRunConfig Bootstrap 127.0.0.1:51000
Alias /CFIDE C:coldfusion8wwwrootCFIDE

Notice the JRunConfig directives. They’ve been updated with the path to CF8 and a unique proxy port number. If you used CF8 for your default then you would be specifying the port and path to CF7. You will not choose a different port number for each virtual host. Don’t get the wrong idea. That is the proxy port for CF8 here. So each Virtual Host you want to run with CF8 will get the same 2 lines added to its settings.

If you notice, the path C:/coldfusion8/runtime/lib/wsconfig/1/ doesn’t exist yet. We need to create it. It’s easier to copy it from the version of Coldfusion that has already been connected. The path will be the same. Copy the folder ‘1’ over to the wsconfig folder, including the files it contains.

Don’t forget the CFIDE alias. You may even need to add a DIRECTORY definition to allow access to it.

Apache is now configured and ready to go. But we’re not done yet. We need to update the CF version we didn’t connect to use the new port number we chose above.

Dig out the JRUN.XML file in C:coldfusion8runtimeserverscoldfusionSERVER-INF (assuming we connected CF7) and change the proxy port to the one from above, along with activating the proxy itself:


false
51000

Save your changes. Restart Apache and the Coldfusion Services.

Load up cf8testsite.local in a web browser, and I put a dummy index.cfm in there to dump the SERVER scope to make sure its using the version I want.

That should do it.

UPDATE (2/15/2010):
If using Railo also, remove the following from the default apache confi settings and place them in the CF virtual hosts. Remember to update the path and proxy port to the appopriate versions:

AddHandler jrun-handler .jsp .jws .cfm .cfml .cfc .cfr .cfswf
JRunConfig Serverstore "C:/coldfusion8/runtime/lib/wsconfig/1/jrunserver.store"
JRunConfig Bootstrap 127.0.0.1:51000

Take a look at the related articles for more information.

Leave a Reply

Your email address will not be published. Required fields are marked *