The Cold Fusion Web Database Construction Kit

Previous chapterNext chapterContents


- 4 -
Installing and Administering Cold Fusion



Once you have established that your system meets the requirements for running Cold Fusion, you can move on to the installation process. This chapter will show you how to install Cold Fusion and Crystal Reports and then how to administer Cold Fusion using the Cold Fusion Administrator.

Installing Cold Fusion

Cold Fusion is installed from floppy disks or CDs supplied by Allaire, or the CD accompanying this book. To install Cold Fusion, from File Manager under Windows NT 3.51 or Windows NT Explorer under Windows 4.0, select the drive where the installation files are stored and run CFUS20.EXE. This will start the installation routine. During installation, the Web server you are running will be identified and Cold Fusion will configure itself to run efficiently with the server. If you are running an unsupported server, you may need to make some manual adjustments in order to complete installation. Figure 4.1 shows the opening screen of the installation program.

The installation routine will prompt you to identify the installation directory. By default, this directory is C:\CFUSION. Figure 4.2 shows the directory selection dialog box.

A selection screen of optional components that can be installed will be presented next. By default, all options are selected. Individual items can be deselected by clicking the check box associated with the undesired item. Figure 4.3 shows the Optional Components screen.

The installation will attempt to automatically identify the Web server software that is running on your server. It will present a dialog box indicating the possible choices. Select the server that you are running, if it is present. If your server is not in the list, select the Other Server option and follow the prompts. Figure 4.4 shows the Web Server Selection screen.

Figure 4.1  The opening screen of the Cold Fusion installation program, showing the license agreement.

Figure 4.2  The Cold Fusion Destination Directory selection dialog box as shown during installation.

Figure 4.3  The Cold Fusion optional components selection screen.

Figure 4.4  The selection screen showing detected Web server software and sofware choices.

If your server was shown in the selection screen, the next screen will show a dialog box with the current root of your Web server selected. For example, if Website Pro was installed on your server, the root of your Web server document directory might be C:\WEBSITE\HTDOCS. The current document directory will be highlighted. Figure 4.5 shows the Web Server Document Directory selection dialog.

Figure 4.5  The selection dialog for choosing the Web Server Document Directory.

Once the Web Server Document Directory has been selected, the installation routine will begin copying files from the installation disk to the destination directory. It will also create a directory structure under the Web Server Document Directory, which will contain example applications and documentation. Midway through the installation, the installation program will warn you that the ODBC files are going to be installed and that you should exit all applications. After you have closed any programs that may be open, press the OK button to proceed with the installation.

If your Web server was not presented in the selection box, and you selected the Other Server option, you will be presented with a screen to select the Web Server Document Directory. It is the same screen as shown in Figure 4.5, but you will have to select the directory which is the root of your Web server document tree. Once you select the document directory, the installation will continue as described above.

By default, Cold Fusion installs and configures itself to use the native API of the Web server in use on your server, and creates document mappings so that the Cold Fusion templates can be called using standard HTTP URL references. To configure your system to use CGI calling methods instead of API methods, after installation has been completed, locate the CFML.EXE file in the \CFUSION\BIN directory, and copy it to the CGI directory of your Web server. Typically this is \CGI-SHL or \CGI-BIN. Cold Fusion can then be run as a standard CGI application.

Verifying Installation

Verify that the Cold Fusion is installed and running by running the Services applet from within the NT Control Panel. The screen showing the running services, including Cold Fusion will look something similar to Figure 4.6.

Figure 4.6  The control panel Services screen showing the status of Cold Fusion.

Cold Fusion installs a set of example templates and documentation which can be accessed by pointing your Web browser to the /cfdocs/ directory on your Web server.

Verify that your installation of Cold Fusion is complete by running one of the sample applications. You can also test to see that the CFML CGI script has been properly installed (assuming you copied the CFML.EXE file into your CGI directory as described previously), by pointing your Web browser at your server with the url:

http://www.yourserver.com/cgi-shl/cfml.exe

Substitute your server name and CGI directory where appropriate. If the CFML CGI script was successfully installed, an error message will be displayed in your browser explaining that a template file was not passed to Cold Fusion. It will also display the version of the CFML script that was run.

Writing a "Hello World" Template

Our first Cold Fusion template will be the tried and true "Hello World" application. Using your favorite editor such as Notepad or Wordpad, open a new document. Listing 4.1 shows the line that needs to be entered into the document.

Listing 4.1  Hello World

HELLO WORLD!

Save the file as hello.cfm and place it in the /cfdocs/ directory of your Web Server Document Directory. To test your first Cold Fusion template, point your Web browser to /cfdocs/hello.cfm. If everything is running ok, you should see output that looks like Figure 4.7.

Figure 4.7  Results of the "Hello World" template as displayed by the Web browser.

Installing Crystal Reports

Crystal Reports 5.0 is bundled with Cold Fusion. This is a report design package that is used to create custom reports. Crystal Reports can be installed on your server or on a workstation. Allaire has developed an interface to the Crystal Reports using the Crystal Reports Web engine. Use of this feature is shown in detail in Chapter 16, Advanced CF Tags. The instructions here reflect installation to the server. Installation on workstations may vary slightly. To install Crystal Reports, from File Manager under Windows NT 3.51 or Windows NT Explorer under Windows 4.0, select the drive where the installation files are stored and run CR50.EXE. This will start the installation routine. A dialog box similar to Figure 4.8 will be displayed, asking if you wish to install Crystal Reports 5.0. If you wish to continue, press the OK button; otherwise press Cancel.

If you pressed the OK button, the installation routine will begin copying files to a temporary directory on your server before continuing the installation process. Once temporary files are in place, the installation process will begin. The opening installation screen is shown in Figure 4.9. Crystal Reports can be installed to a single computer, a shared LAN installation, or can be set up from the LAN onto individual workstations. These instructions will show the local install.

Figure 4.8  The Crystal Reports installation confirmation screen.

Figure 4.9  The opening Crystal Reports installation screen.

Once you have selected the local install option, Crystal reports will prompt you for the location to install CR and a choice for an automatic or custom installation. This screen is shown in Figure 4.10. Selecting the custom installation option allows you to select the various components of Crystal Reports that are installed.

Figure 4.10  The Crystal Reports options selection screen.

Administering Cold Fusion

Cold Fusion is administered using the Cold Fusion Administrator, which is installed in the BIN subdirectory where CF is installed. By default the administrator is found in the \CFUSION\BIN on the server. An icon for the administrator is installed in the Cold Fusion Professional 2.0 program group under WinNT 3.51 and in a Start Menu group under WinNT 4.0. The file name of the administrator is CFADM20.EXE. When running the CF administrator it appears as a tabbed property sheet as shown in Figure 4.11.

The tabs in the administrator allow the configuration of the various features of Cold Fusion.

Figure 4.11  The Cold Fusion Administrator appearing as a tabbed dialog box.

Administering the CF Server

The CF Server settings are set by clicking on the Server tab within the Cold Fusion Administrator. This tab allows the administrator to control the server, by starting it, stopping it, and restarting it after making changes. Additionally, certain performance settings can be adjusted. The number of threads that the CF Server can handle is set here, which defaults to 15. Certain database drivers such as Oracle require a single threaded operation, so the number of threads supported by CF can be configured. Additional requests are queued and then processed. A time-out value is also configurable, which tells the CF Server how long to wait before terminating a long request. The default value is 60 seconds. After making changes to the number of threads or time-out value, the server must be stopped and then restarted for the changes to take place. Figure 4.12 shows the CF Server Administrator tab.

Figure 4.12  The CF Server Administrator tab.

Configuring Cold Fusion to Provide Debugging Information

CF provides a number of pieces of debugging information that can be configured using the Debugging tab in the Cold Fusion Administrator. The information that can be provided includes the following:

Debug settings can be overridden by providing the additional URL parameter MODE=debug when calling a CF template. An example would look like:

http://www.a2z.com//guest/guest.cfm?MODE=debug

To help the user provide information to the developer, an e-mail address can be configured that will create a mailto: link if an error is encountered. Additionally, all errors are logged in to the error log file specified in the log directory field of the debug tab. Figure 4.13 shows the Debugging tab.

Figure 4.13  The CF Debugging tab.

Configuring Cold Fusion to Send SMTP Mail

Cold Fusion introduced the ability to interact with an SMTP mailer in version 1.5. This provides the developer with the ability to have data driven e-mail messages sent from Cold Fusion. To set up Cold Fusion to use the <CFMAIL> tag, the SMTP mail system must be configured using Mail tab in the Cold Fusion Administrator. Within the Mail tab there are two major areas, connection settings and logging.

Connection settings

Logging

Figure 4.14 shows the Mail tab.

Figure 4.14  The Cold Fusion Mail configuration tab.

Installing Custom CFX Tags

In version 2.0, Cold Fusion has added the ability for developers to extend the functionality of Cold Fusion by creating custom tags. In order to use the custom tags, they must be installed using the Cold Fusion Administrator. To add a custom tag built using the CFAPI, select the CFX Tags tab in the Cold Fusion Administrator. Select the Add button, which will display the Add Custom Tag dialog.

The Add Custom Tag dialog has entries for the following information:

Figure 4.15 shows the CFX Tags tab.

Figure 4.15  The Cold Fusion Adminstrator, showing the CFX Tags tab.

Figure 4.16 shows the CFX Add Custom Tag dialog.

To change the settings of a custom tag, select the CFX Tags tab and press the Settings button. A dialog box is displayed with the same entries as the add dialog, but is used to modify the settings for a custom tag.

Figure 4.17 shows the Custom Tag Settings dialog.

To delete a custom tag when it is no longer required, select the CFX Tags tab, highlight the tag you want to delete, and press the Delete button. This removes the pointer information for the tag, not the DLL itself.

Figure 4.16  The CFX Add Custom Tag dialog box.

Figure 4.17  The CFX Custom Tag Settings dialog box.

Establishing Logical Template Mappings

The location of your CF templates is very important. They must be protected from un- authorized use, and must be protected from unauthorized changes, which might result in tampering with your data.

The Cold Fusion Administrator provides a method to map logical locations for templates, which are separate from the physical location of the templates. This concept is similar to Web server directory mapping. A default template location is created when you first installed Cold Fusion. This default is \CFUSION\TEMPLATE on the drive on which you installed CF. You can use this directory to store your templates, or you can create subdirectories to organize your templates by application. No matter where you put your templates, you must configure Cold Fusion to recognize the physical location of your templates based on the logical mapping. This allows you to refer to the template in the cgi environment without specifying its physical location.

To create template mappings:

1. Start the Cold Fusion Administrator and select the Mappings tab. Figure 4.18 shows the screen layout.

2. From the Mappings tab, type in the logical path you want to use for your tem-plates in the logical path field. In our examples the A2Z templates are kept in C:\A2Z\TEMPLATES, but we refer to them in CF as being located in /a2z/. The logical path in this case is /a2z/.

3. In the directory name field, enter the fully qualified directory name where the templates will be stored. The Browse button will display a dialog box from which you can select the directory. Press Add to complete the mapping.

4. To replace an existing mapping entry, edit the entry by selecting the logical entry, enter the new data into the appropriate fields, and press the Replace button.

5. To delete a mapping entry, highlight the entry and press the Delete button.

6. Press the Apply button to cause CF to apply the changes and use the new entries.

Figure 4.18  The Cold Fusion Template Mappings tab.

Using CFADM20 to Remotely Administer CF

Cold Fusion provides the ability to remotely administer a CF installation using the Cold Fusion Administrator. The syntax to start the administrator for remote operation is:

CFADM20 -r SERVERNAME, where SERVERNAME is the NetBIOS name of the server where CF is running. This must be run from a Windows NT workstation or server, or from a Windows 95 workstation that has the remote registry service software installed. Due to limitations in the way ODBC data sources are created, the ability to create and manage ODBC data sources is not available when remotely managing a CF installation.

You can update template mappings, change debugging information, and update the Mail tab while running CF Administrator remotely. This is handy when your server is located some distance away from you and you need to make a quick change. When running remotely, the administrator functions as if you were on the console with the exception of the ability to configure data sources, manage the server and add or update custom tags. To do any of these things, you will need to run the Administrator from the server console.

From Here...

In this chapter you have successfully installed Cold Fusion and tested the installation. In the next few chapters you will be introduced to the Cold Fusion Markup Language (CFML), and you will develop a sample application.


Previous chapterNext chapterContents

© Copyright, Macmillan Computer Publishing. All rights reserved.