Using server variables

The server scope can be used both to create and use variables that are available to all applications on the ColdFusion instance, and it offers dozens of pre-defined (read-only) variables describing your ColdFusion server environment.

Create and use server variables

Use server variables for data that should be accessible across all clients and applications. You access and manipulate server variables the same way you use Session and application variables, except you use the variable prefix Server.

Server variables do not time out, but you can delete them. Because server variables are stored in memory on the current instance, they are lost when the instance shuts down. They are also not shared between instances in a ColdFusion cluster.

Note:

Place code that uses server variables inside cflock_ tags in circumstances that could result in race conditions from multiple accesses to the same variable. You do not have to lock access to built-in server variables._

Use ColdFusion’s pre-defined server variables

ColdFusion provides the following standard built-in read-only server variables:

server.coldfusion

<cfscript>
val=server.coldfusion
writeDump(val)
</cfscript>
<cfscript> val=server.coldfusion writeDump(val) </cfscript>
<cfscript>
    val=server.coldfusion
    writeDump(val)
</cfscript>
Variable Description
InstallKit The OS on which ColdFusion is installed.
appserver The application server that ColdFusion is running on, for example, Tomcat.
expiration The expiration date of ColdFusion license.
productlevel Indicates if ColdFusion on your machine is Developer or Enterprise.
productname ColdFusion server.
productversion The ColdFusion version that is currently running.
rootdir Directory under which ColdFusion is installed, such as C:\<cfhome> or /opt/<cfhome>/cfusion .
supportedlocales The locales, such as English (US) and Spanish (Standard), supported by the server.
updatelevel The current update (hotfix) level applied to the installed version of ColdFusion.

server.os

<cfscript>
val=server.os
writeDump(val)
</cfscript>
<cfscript> val=server.os writeDump(val) </cfscript>
<cfscript>
    val=server.os
    writeDump(val)
</cfscript>
Variable Description
additionalinformation The OS on which ColdFusion is installed.
arch The processor architecture, such as x64 or ARM.
buildnumber The expiration date of ColdFusion license.
name The name of the OS where ColdFusion is running.
version The version of the OS.

server.system.environment

<cfscript>
val=server.system.environment
writeDump(val)
</cfscript>
<cfscript> val=server.system.environment writeDump(val) </cfscript>
<cfscript>
    val=server.system.environment
    writeDump(val)
</cfscript>

Lists various environment variable names that describe system-level settings and configurations. These include identifiers for system paths (like ProgramFiles, SystemRoot, Path), processor details (PROCESSOR_ARCHITECTURE, PROCESSOR_IDENTIFIER), operating system information (OS, NUMBER_OF_PROCESSORS), user-specific directories (APPDATA, USERPROFILE), and configuration flags (for example, _PSLockDownPolicy, ZES_ENABLE_SYSMAN). These variables provide essential metadata used by the operating system and applications to understand the system environment, manage resources, and find execution contexts.

Get help faster and easier

New user?