Raymond Camden's Blog Rss

Cross Operating System ColdFusion Development Guide

The following guide discusses issues, problems, and tips for ColdFusion code and multiple operating systems. While you may be sure your code will always run on a particular operating system, you can't be certain that it may need to be migrated in the future. Therefore, please consider the following suggestions to help smooth the migration.

This guide was last updated on May 25, 2009. Contributors include: Mark Jones, Adrian J. Moreno.

1) When it comes to creating file paths, don't worry about \ versus /. Just use /. The / character will work on Windows, OSX, and Linux systems. Yes, you can write code to check for the proper file path separator, but if you are just reading or writing to a file, why worry about it?

2) Don't let case sensitivity ruin your day. On more than one occasion I've worked with code that was fine on OSX and Windows, but failed on Linux because of case sensitivity issues. The simplest solution is to simple lowercase everything. Ie: klingon.cfc, ships.cfm, index.cfm, etc. Of course, the exception to this are the files ColdFusion use for application-specific functionality: Application.cfc, Application.cfm, and OnRequestEnd.cfm. Everything else though should be lowercased.

Note - case sensitivity can also impact SQL. Table names, for example, in MySQL may be case sensitive. If you have control over table names, you may wish to consider using all lowercase names.

3) Minimize the use of operating system specific features called via cfexecute. This may be out of your control, but if you write CFML that makes use of cfexecute to run command line code, you want to ensure you are using a command line tool that runs on multiple operating systems, and runs with a similar API. You may not be able to though, so at minimum, this is a perfect example of something that should be carefully documented for your client so they are aware of the dependency.

4) If your application makes use of a particular database, like SQL Server, consider whether or not you may need to move to an operating system where it may not be supported. SQL Server, for example, only runs on a Windows machine, while MySQL will work in almost all environments.

5) Some operating systems may be set up in 'headless' mode, which basically means a machine with no graphical UI. While there is nothing you can do about this in your code, there are things you can do when setting up your ColdFusion server. I recommend the Alagad Image Component link in the list below.

Useful links: