onServerStart
Called upon startup of the server. Typically defined in server.cfc and placed at the webroot. In the ColdFusion Administrator > Setting check 'Component with onServerStart() method' and specify the file. The function is useful for application-independent tasks, and specifying the server specific environment variables and other general tasks.
function onServerStart() { } → returns void
This function requires Adobe ColdFusion 9 and up. Not supported on Lucee, etc.
Links more information about onServerStart
- Adobe ColdFusion reference - From the Adobe documentation. Useful to see the typical setup.
- Manually calling onServerStart - Raymond Camden shows how to easily manually call the onServerStart function.
Examples Sample code invoking the onServerStart function
Setting server specific variables
<cfcomponent> <cffunction name="onServerStart"> <cfset server.environment = "Dev-Server"> <cfset server.tech_support = "joe.bloggs@example.com"> </cffunction></cfcomponent>
© 2012–present Foundeo, Inc. and the CFDocs contributors.
Licensed under the MIT License.
ColdFusion is a trademark of Adobe Systems Incorporated.
https://cfdocs.org/onserverstart