Web DevCenter
oreilly.comSafari Books Online.Conferences.
MySQL Conference and Expo April 14-17, 2008, Santa Clara, CA

Sponsored Developer Resources

Web Columns
Adobe GoLive
Essential JavaScript
Megnut

Web Topics
All Articles
Browsers
ColdFusion
CSS
Database
Flash
Graphics
HTML/XHTML/DHTML
Scripting Languages
Tools
Weblogs

Atom 1.0 Feed RSS 1.0 Feed RSS 2.0 Feed

Learning Lab






ColdFusion MX on Mac OS X, Part 3
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11

Run ColdFusion MX on Mac OS X

Well, girls and boys, that time we have all been anticipating has finally arrived--it's Christmas in August!

  1. From the Mac OS X Terminal window, execute the shell script by entering:

    /opt/coldfusionmx/bin/coldfusionosx start

    Author's Note: You can also stop or restart CFMX by issuing the above command and substituting the parameter (last word) with the desired action.

    When you see the message: Server default ready, ColdFusion MX is running on Mac OS X!

  2. Open a browser and enter the following into the address bar:

    127.0.0.1:8500

    This is the Loopback address to our computer. :8500 is the port where the CFMX Default Web Server listens for requests.

  3. You will see an "Index Of" page with two items listed: Wow, that's really impressive!

    Actually, it is impressive, because it shows us that:

    • the Java Virtual Machine (provided with Mac OS X)
    • JRun Application Server
    • the Macromedia-supplied "Default" Web Server

    are all running on your machine. What you are seeing is an "Index of" files in the Web root of a Web server. The index is displayed because there are no default Web pages currently installed in the Web root.

  4. Click on the CFIDE link and you will see another "Index Of" page.

  5. Click on the administrator link. You will see the CFMX Administrator login screen. This is it folks. This page, and any page from this point on, is being parsed and generated by the ColdFusion MX Web Application Server.

    Log in with the password you entered when you installed ColdFusion (on Linux).

  6. The Login screen disappears, and is replaced with a ColdFusion Administrator screen, followed by a "Welcome to ColdFusion MX" popup window.

  7. In the popup window select the Example Applications >> link.

  8. When the next page is displayed, select the Check for Applications on this server link.

  9. Experiment with the examples provided. Many of the examples use the PointBase relational Database Server provided with CFMX.

    Author's Note: A few things should be mentioned about performance:

    One: consider all that's going on: both ends of a Web application, the client (your browser), and the server or Web Host (Application Server, Web Server, Web Application Server, Database Server) are all running on the same machine along with the Internet protocol (Loopback Connection). You wouldn't run a production Web site configured this way. The components are all competing for resources. The Database Server, for example, would run on different CPU and hard disk matrix.

    Two: your machine is probably way under capacity (RAM, CPUs, Speed, Disk Speed, and so forth) to run a Web Host (not to mention a browser, and all the other applications you are currently running).

    Three: When a ColdFusion template (program) is first requested, it is retrieved from disk, parsed by the ColdFusion MX Web Application Server, then compiled into a Java (Virtual Machine) program, then translated into a Physical Machine program, then executed. ColdFusion MX has a sophisticated caching system, which allows much of this "Overhead" to be avoided for subsequent requests for the same template.

    Four: Some of the ColdFusion MX Services, graphing, for example, start up the first time a template requests the service.

    Five: Every CFMX Web page that you request is being requested for the first time and includes all the associated overhead. This overhead is noticeable (and acceptable) in a Local Integrated Development Environment (IDE), but would virtually disappear in a Production Web site that runs for months (years?) with thousands of hits to the same templates.

    Considering all the above, performance seems pretty good! With a little experimentation, I have found that CFMX performs as well as or better than PHP or Perl in a similar environment--but with a whole lot more to offer! You can experiment for yourself. Other articles at the O'Reilly Mac DevCenter discuss activation of some of the Web Host components available to Mac OSX -- Apache Web Server, PHP, Perl, MySQL, and so on.

  10. OK, we have one more thing to do--develop our own CF application. Remember our little phone list program from part 2 of this series? Let's use that! (It conveniently uses one of the databases included with CFMX.) In the Finder, browse to:

    opt ==> coldfusionmx ==> wwwroot

    You'll see three folders: the CFIDE and cfdocs folders we just saw when we opened our browser to 127.0.0.1:8500. The third, WEB-INF is a CFMX-internal folder that is not directly accessible from the Web. Create a folder named: mycfmxapps to hold your CFMX programs. Folders placed in wwwroot are Web folders, so avoid any spaces or special characters in their names.

  11. Below is our phone List program from part 2, with the first statement added to simulate receiving a request from a form on a prior Web page. Copy this program into a text editor and save it to our newly created mycfmxapps folder as PhoneList.cfm.

    <cfset Form.Department = "Sales">
    
    <cfquery name="getPhone" datasource="cfsnippets">
      SELECT    LastName, FirstName, Phone
      FROM      Employees
      WHERE     Department='#Form.Department#'
      ORDER BY  LastName, FirstName
    </cfquery>
    
    
    <h1>Department Phone List</h1>
    
    
    <table border="1" cellspacing="0" cellpadding="3">
      <tr>
        <th>Name</th>
        <th>Phone</th>
      </tr>
    
    <cfoutput query="getPhone">
      <tr>
        <td>#LastName#, #FirstName#</td>
        <td>#Phone#</td>
      </tr>
    </cfoutput>
    
    </table>
  12. In a browser window, enter:

    127.0.0.1:8500/mycfmxapps/PhoneList.cfm

    You should see the Department Phone List with dynamic content that was retrieved from a database.

Ta-Dah! We just met the objective that we set many weeks ago; we have a complete CFMX IDE running on Mac OS X!

Be sure and try the other example programs (as if I could stop you), experiment with the CFMX Administrator, review the online (to your local Web server) documentation.

Best of all--write and test your own CFMX Web programs entirely on your own Mac computer!

This is really slick! The Best Web Application Development System running on the Best Personal Computer with the Best Personal Computer OS.

Well, you've finally got your powerful new system installed and lots of exciting new things to explore. Enjoy!

In the next article, we will review and refine our CFMX Mac OS X installation. We will:

  • Investigate some additional relational databases such as: MySQL, PostgreSQL, Full PointBase, OpenBase.
  • Discuss what it takes to interface other programs available on Mac OS X. These include: Apache Web server, Flash MX, and DreamWeaver MX.
  • Install and run the Macromedia's showcase Pet Market Blueprint application.
  • Introduce some of the advanced features of CFMX, such as Web Services, Flash Remoting, and JSP interfaces.
  • Look at some exciting CFMX projects being done by others and available to us on a Mac for the first time (because of Mac OS X).
  • Finally, we will summarize what it all means and where you go from here.

Dick Applebaum has been doing Web development since 1997, primarily with ColdFusion -- including his latest challenge to port ColdFusion MX to Mac OS X.


Return to the Web Development DevCenter.