21 March 2011
This tutorial gives you step-by-step instructions for setting up your ColdFusion development environment on Windows using an Apache web server. You will also learn how to set up ColdFusion Builder 2 as your editor. I have written this article for beginners to ColdFusion, thus, no prerequisite knowledge is required.
First, you will follow steps to install all the software elements for your ColdFusion development environment. This includes installing Apache as your web server, installing ColdFusion so that you can create and run dynamic applications, and installing ColdFusion Builder 2 to help you develop those applications.
To serve your web pages on the Internet you must install a web server. The Apache Web Server (also known as HTTPD) is free and open source, and used in many production environments due to the stability and flexibility that it offers web developers.
Download Apache and start the Apache Web Server Installer (as of this writing, the current version is 2.2.16). When the Apache installer starts, a Security Warning screen may appear (Figure 1). This is standard for applications downloaded from the Internet. Click Run to start installing Apache Web Server.
Click Next on the Apache HTTP Server welcome screen. As with all installers, the next screen asks you to read the software license agreement. To proceed, accept the agreement and click Next.
The install process next presents a Read This First screen. If you haven't used Apache HTTP Server, this information explains Apache web server, the latest version number and the installation steps. After reading this information, click Next.
The Server Information screen will show all the default settings, such as your computer name and your computer's assigned domain. The default settings are sufficient for your local development. When installing the server on a production machine, however, you may wish to change the settings to be more secure. You'll be able to get these details from your network administrator. The options at the bottom of the screen specify the port the server will be installed on. HTTP Servers are usually installed on port 80. If your windows machine has Internet Information Server installed already, it may already be using port 80, so there may get a conflict on port 80. If you install Apache on port 80, it may seem like Apache didn't install correctly. Once the installer has completed you can change the port in the HTTP configuration file so that Apache doesn't clash with another web server on the same port. (Also if you have Skype installed, you must not run it at the same time as this installation process, as Skype also runs on port 80 if nothing else is running on port 80 at the time it starts. If another software is using port 80 and Skype starts, it will select a different port number.)
Once you are happy with the settings, click Next.
Select the Setup Type that best suit your development purposes. For the purposes of this article, select Typical and click Next.
On the Ready to Install screen, click Install to start the installation process.
Before the installer proceeds, you may get security warning informing you that the installer will make changes to your computer. If it's safe for Apache to make these changes, click Yes.
The Installer will copy over all the files you need. A few black command prompt boxes will appear as files and services are installed. Once the installer is complete, click Finish.
If a black command prompt informs you that Apache couldn't start because it couldn't find or use port 80, this could mean there is another process already using port 80. Again, check to see if IIS is already installed or if Skype is running. You can stop the IIS service or quit Skype, or change the port that Apache Web Server uses as follows.
To see Apache HTTP Server running, load a web page served by Apache web server in a browser. If you are using Apache on port 80, you can simply browse to http://localhost. If you have your port set to 92, you must add the port number to the URL you are browsing, for example: http://localhost:92.
In this section, I explain how to install ColdFusion 9 followed by instructions on how to apply the ColdFusion 9.0.1 Updater to ensure that you have the latest edition of ColdFusion.
As with all software installers there is the License Agreement to read and accept before proceeding. For the purposes of this tutorial, you will install the ColdFusion Developer Edition, which is free and doesn't require a serial number. The limitation on the developer edition is that you can only have two unique IP addresses accessing the server and watermarks appear on some of the features.
You have three options to choose from for your installer configuration:
I suggest selecting Enterprise Multiserver configuration. By choosing this option, you can run multiple servers, each with a different configuration, which gives you the full benefit and power of the ColdFusion platform. Once you have selected the Enterprise Multiserver option, click Next.
Next, you have the option to install ColdFusion subcomponents; to have the full power of the platform, leave all the options selected. When you install ColdFusion in your production environment, however, only install the components that are required. In production you shouldn't install the Documentation as this isn't required to run ColdFusion. Once you have selected your subcomponents, click Next.
You will then select the directory to install ColdFusion , unless you have a company or IT policy for the location to install new software, you can use the default location. If this is the case, click Next. If you have selected the .NET Intergration service, you will be asked for the directory to install it to.
In the next screen, select the Web Server that will connect to ColdFusion. Click Add.
You will then need to select the location of the configuration file for Apache and the Apache binary file. If you have selected the default installation for your Apache web server installation, the locations will be:
64 Bit Platform
32 Bit Platform
Once you have entered these details, click OK.
Now the Apache web server is listed under the web servers (Figure 13). Click Next.
Using the data selected, the installer asks you to specify the location for ColdFusion 9 Administrator; the default location for this is the webroot for Apache. For the purposes of this article, I recommend that you leave the default settings. Click Next.
Enter a password to access the ColdFusion administrator. The password is required you cannot enter a blank password once you have entered your selected password. Click Next.
The install request whether you want to Enable Remote Development. You can enter a password. This can be different than the ColdFusion Administration password. You will need to remember this password when you connect ColdFusion Builder to your ColdFusion instance. Once you have enabled RDS and entered a password click Next.
The almost-final screen of the installer is the summary screen. Confirm all the options selected, then click Install.
The installer will start. Once the installer has completed click the Done button and the ColdFusion Administrator will open.
Enter the password you entered in the installer for ColdFusion Administrator.
ColdFusion Administrator will finalize the installation. Once complete, click OK. The ColdFusion Administrator will open indicating that the install is complete.
Next, you will install the ColdFusion 9.0.1 Updater. You will see the Windows Warning that the installation program will make changes to your computer, the quick introduction, and the license agreement. Click Next in all of these cases to proceed.
Select the install type. Select the same option selected in the main ColdFusion installer, which is in this case the Multiserver configuration. Click Next.
You must shut down all ColdFusion instances before proceeding. Using the Services interface stop the following services:
Once the services have been stopped, you will then be asked for the location where you installed ColdFusion. if you selected the default settings in the main installer, leave the location as the default value and click Next.
You will then be asked for the location of the CFIDE folder. Again if you selected the default options in the main installation, you can leave the default location and click Next.
The installer will then start. Once it is complete, the installation reviews the changes made in the Install Complete screen. Once you have read through this screen, click Done. Check that the install has installed fully by opening the ColdFusion Administrator, clicking the System Information button at the top right of the Administrator, and checking that the Version number is 9,0,1,274733.
Shortly after the release of ColdFusion 9, Adobe also released an IDE dedicated to ColdFusion based on the Eclipse Platform. Installing ColdFusion Builder 2 will help with all your ColdFusion development tasks.
When you start the ColdFusion Builder 2 installer, you may get the security warning that the application will make changes to your computer. Click Yes to proceed with the installation. The installer starts and shows you an introduction screen, click Next. The license agreement screen appears. If you agree with the license agreement, select the accept option, click Next.
You have two ways to install ColdFusion Builder 2:
If you don't have Eclipse or Flash Builder installed on your machine, select the Standard option. By selecting the Standard option, the installation will give you Eclipse, into which you can install additional plugins. If you have already installed Eclipse or Flash Builder, select the plugin option. (Note: You cannot run ColdFusion Builder 2 and CFEclipse in the same install.) For the purposes of this article, I suggest you select the Standard option.
Select the folder to install ColdFusion Builder 2 into. Unless you have a company policy/instructions from your IT department for the location to install new software, you can select the default location. Click Next.
You can also associate .CFM and .CFC files to open with ColdFusion Builder 2 when you click those files in Windows Explorer. If you do not wish to have this feature, deselect this option and click Next.
The installer presents a confirmation page for you to review the options you selected. Check the information shown and when you are ready, click Install.
Once the installer has completed, and ColdFusion Builder 2 will start. When ColdFusion Builder 2 starts for the first time, you will be asked for the location of your workspace. You can change the workspace to a location of your choice or leave as the default. You normally will want to use the same workspace every time, so select the option "Use this as the default and do not ask again".
When ColdFusion Builder 2 starts you are prompted to enter a serial number, if you have one, enter it here, otherwise select the 60-day trial and click Next.
Next, the installer asks you to sign into your Adobe Account. You can skip this or enter your Adobe ID if you have one. If you don't already have an Adobe ID you can easily create one here. When ColdFusion Builder 2 starts, it shows a start page that gives quick access to the features of ColdFusion Builder 2.
Now that you have ColdFusion 9.0.1 and ColdFusion Builder 2 Updater 1 installed, you can set up ColdFusion Builder 2 to enhance your development.
The first task is to add ColdFusion to ColdFusion Builder 2 in the Server view. Click the Server tab and click the Add Server button.
Specify the following connection details for your server:
Next, enter your local settings. If you selected the default settings for your ColdFusion install, you can enter the Server Home as c:\JRun4. This will automatically specify the document root.
Click the URL Prefix table and type the following:
Click Add and Next.
You then have the option to install the extensions that come with ColdFusion Builder 2. To do so, leave the default options selected and click Finish.
Your server then appears in the Server panel.
If you right-click your server, you can restart, stop, and edit the settng for the server. You're also able to access your ColdFusion Administrator.
When you open the ColdFusion Administrator, a panel displays in full screen. You can double-click the Tab to minimize it.
When you click the Services Browser tab, you can see all the web services available on your ColdFusion.
In the Extensions tab you can see all the extensions you have installed and on which server. If you have multiple servers set up, you can see which server the extension will run from.
Now that you have your server set up, you can create a ColdFusion Project in the navigator panel. Right-click the menu and select New > ColdFusion Project.
The new project window opens. Give the project a name, deselect the Use Default Location, and enter the Apache web root as C:\Program Files\Apache Software Foundation\Apache2.2\htdocs. Click Next.
In the server details screen, select the server you have created and click Finish.
Right-click your new project and select New > Folder.
Create a new folder called artistscfcs and click Finish. Repeat this step and create another folder called artistsorm.
In the main ColdFusion Builder 2 screen, select the RDS Dataview, which will show all the databases that are set up in your ColdFusion. Expand the
cfartgallery data source, and then expand the data source's tables. Right-click the
After right-clicking the table, you will see a list of options. You can view the contents of the table, which is a quick way to see the data of the table. You can also run the Query Viewer, which allows you to write queries. The lower section of the screen contains some of the extensions that were installed when you added the server to ColdFusion Builder 2. Select the Adobe CFC Generator > Create CFC option from the menu.
You will be asked where the CFC should be stored. Click the Browse button and select the folder artistscfc folder that you created earlier. Click OK.
If you wish to see the fully-scripted cfc, select the Script CFC option. If you don't select this option, the Extension will generate standard ColdFusion code. Click OK.
In the navigator panel you will see four new files:
artiststable (Create, Read, Update, Delete single rows)
artiststable, giving you a great start in developing an OOP application
In the RDS Dataview if you click the RDS Query Viewer you will be able to write very simple SQL statements.
Now that you have connected everything, you can create a new file by right-clicking in the Navigator and selecting New > ColdFusion Page. Enter the name of your new file. This will create this file in your navigator. In this example, enter index.cfm as your file name.
In the new file, type the following:
<cfset artistsObj = createObject("component",</p>
By pressing CTRL + SPACE BAR, ColdFusion Builder will complete the code and you'll be able to select
artistscfc.ArtistsService, which will auto- complete the
Artists service in your code.
Placing a period after the closing parentheses will invoke the code insight on all the methods on the object, as this is the instantiation of the object selected in the init() function.
Finish the code as follows:
<cfset artistsObj = createObject("component","artistscfcs.ARTISTSService").init() /> <cfset artistsQry = artistsObj.getAllARTISTS() /> <cfdump var="#artistsQry#"/>
You can click the IE tab at the bottom of the code editor to preview the page. By doing so, you can see an array dump of the objects that Adobe CFC Generator and your snippet of code generated.
If you require the Web Server to display your index.cfm file as the default page (no need to explicitly have index.cfm in the url) open the httpd.conf file located at:
C:/Program Files (x86)/Apache Software Foundation/Apache2.2/conf/httpd.conf.
Search for the line DirectoryIndex and enter index.cfm as the first item using a space separating them the section should look this:
# # DirectoryIndex: sets the file that Apache will serve if a directory # is requested. # <IfModule dir_module> DirectoryIndex index.cfm index.html </IfModule>
This will then serve index.cfm file as the default file of a folder. If a default file of index.cfm doesn't exist, the server will look for and serve index.html. Again if this doesn't exist the web server will either display a directory listing or a forbidden page depending on your Apache setup. The default behavior is to display a directory listing.
If you want the server to serve default.cfm as the default page, you can add default.cfm in the list with a space separator.
Once you have your environment installed, you can customize your install by adding more virtual servers, ColdFusion instances, and install ColdFusion Builder Extensions to help with your development.
For a good introduction to all the features of ColdFusion Builder, see the article, Moving from Dreamweaver to ColdFusion Builder. Although this article is for users moving from Dreamweaver to ColdFusion Builder, the article covers all the main features of ColdFusion Builder.