Flash and PHP Bible Ebook free dowwnload

  

  Flash ® and PHP Bible

  Matthew Keefe Flash

  ®

  and PHP Bible

  Flash ® and PHP Bible

  Matthew Keefe

  ® Flash and PHP Bible Published by Wiley Publishing, Inc.

  10475 Crosspoint Boulevard Indianapolis, IN 46256 Copyright © 2008 by Wiley Publishing, Inc., Indianapolis, Indiana Published by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada

  ISBN: 978-0-470-25824-8 Manufactured in the United States of America 10 9 8 7 6 5 4 3 2 1 No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means,

electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of

the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4355, or online at http://www.wiley.com/go/permissions.

  

LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO

REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE

CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT

LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED

OR EXTENDED BY SALES OR PROMOTIONAL MATERIALS. THE ADVICE AND STRATEGIES CONTAINED

HEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING

THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER

PROFESSIONAL SERVICES. IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT

PROFESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE

LIABLE FOR DAMAGES ARISING HEREFROM. THE FACT THAT AN ORGANIZATION OR WEBSITE IS

REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FURTHER INFORMATION

DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE

ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. FURTHER, READERS

SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR

  For general information on our other products and services or to obtain technical support, please contact our Customer Care Department within the U.S. at (800) 762-2974, outside the U.S. at (317) 572-3993 or fax (317) 572-4002.

  Library of Congress Control Number: 2008925780

Trademarks: Wiley, and the Wiley logo, and related trade dress are trademarks or registered trademarks of John Wiley &

Sons, Inc. and/or its affiliates, in the United States and other countries, and may not be used without written permission.

Flash is a registered trademark of Adobe Systems Incorporated in the United States and/or other countries. All other trademarks are the property of their respective owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book.

Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in

electronic books.

  About the Author

Matthew Keefe is a new-media designer and developer, with a strong background in application

  development for the Web and offline. Originally a full-time graphic artist, he found that much of the programming associated with his design work was being outsourced. Matt quickly learned pro- gramming for the web and uncovered a valuable but little-known skill set in this industry, that skill being the ability to build a site and also the ability to powerfully design it. This was preferred by clients because they could do the entire project with one studio. Matt has worked with companies such as Delphi, PhotoshopCafe, Kineticz Interactive, and Organi Studios to name a few. His work has been published in How To Wow with Flash (Peachpit Press) for which he was a contributing author and technical editor. Matt has also recently finished up work as the technical editor for Essential ActionScript 3 (Adobe Dev Library). Examples of his work can be found in his personal portfolio at mkeefe.com. Credits Senior Acquisitions Editor

  Stephanie McComb

  Laura Moss-Hollister

  Erin Smith

  Graphics and Production Specialists

  Claudia Bell Jennifer Mayberry Ronald Terry

  Quality Control Technician

  Susan Moritz

  Media Development Project Manager

  Media Development Coordinator

  Barry Pruett

  Jenny Swisher

  Associate Producer

  Shawn Patrick

  Proofreading

  Christine Sabooni

  Indexing

  Project Coordinator

  Vice President and Publisher

  Project Editor

  Robyn Siesky

  Beth Taylor

  Technical Editor

  Navid Mitchell

  Copy Editor

  Kim Heusel

  Editorial Manager

  Business Manager

  Bob Ipsen

  Amy Knies

  Sr. Marketing Manager

  Sandy Smith

  Vice President and Executive Group Publisher

  Richard Swadley

  Vice President and Executive Publisher

  Broccoli Information Management To my loving father. acromedia . . . errr Adobe Flash is hands down one of the most impressive and powerful tools for any designer when it comes to bringing an experience to a user. And as Flash continues to evolve not just web, for which it got popular, but also offline users with plat-

M form developments such as Adobe AIR and the wide range of third-party tools that can be used

  But to a hardcore developer Flash has had a bad rap. Mainly due to the fact that AS 1.0 was an awkward, gawky, and immature language. Compared to other languages popular when AS 1.0 was introduced, it wasn’t something to be taken seriously in a developer’s eye and rightfully so. But then if Flash is so hindering, why am I even reading a foreword for a book on the subject? Things have changed, drastically changed. AS 3.0 is here and it is one of the best languages around when understood. AS 2.0 was a step in the right direction, but AS 3.0 has surpassed every Flash developer’s dreams. Small file sizes, very solid performance, and even some data handling that rivals Java, so really there isn’t a developer who can say it is no longer a concrete language.

  And with AS 3.0 a new era of data handling is introduced into Flash. And not only with Flash, but when you start mixing in PHP5, MySQL 5, ASP, AMFPHP, and other methods of handling data, the possibilities open up into a new realm. Data is up for grabs in AS 3.0, and it’s only a matter of read- ing a book like this to apply it. Sockets, xml, web services, and other external data sources allow a Flash developer to get really dirty in a data source and update the content without touching the Flash files again. The benefit is allowing more time to develop an engaging user experience without worrying about repeat edits, a client’s future budget, etc. It actually allows a serious Flash devel- oper to continue to work with data sources as they are developed and concentrate on the benefits of finessing the content itself, rather than what the content is at the time of development that can change on a client’s whim later on. Gone are the days that you would build a client’s website, have a ton of large swfs, only for them to constantly need updates for photos, copy, catalog items, etc. In this book you will read how to uti- lize the methods mentioned to broaden your understanding of taking out the last restriction to knowing powerful Flash, updating without ever republishing, opening up an FLA, or worrying if the client sent you the right copy, image, or other asset. Get rid of the idea that a Flash project is now plagued with an ever-so-changing fla file and embrace the idea of run-time content generation.

  Michael Minor Director of Interactive Media invertedCreative.com

  would like to thank Laura Sinise for helping me to get started. This book would not have been possible without the following people: Senior Acquisitions Editor, Stephanie McComb; Project Editor, Beth Taylor; Copy Editor, Kim Heusel; Technical Editor, Navid Mitchell; and Mary Keefe. I would also like to thank my friends Colin, Philip, Brooke, Frank, Jimmy, and Daz and my cousin Teisha for their huge amount of support. And lastly, I would like to thank my family for their under- standing and patience while I was locked away in my office during all hours of the night.

I

  About the Author ............................................................................................................................v Foreword ......................................................................................................................................vii Acknowledgments..........................................................................................................................ix Introduction ................................................................................................................................xix

  

Part I: Understanding the Basics . . . . . . . . . . . . . . . . . . . . . . . . . . 1

Chapter 1: Getting Started with Flash and PHP ..............................................................................3 Chapter 2: Exploring Flash and PHP ............................................................................................37 Chapter 3: Getting Connected ......................................................................................................63 Chapter 4: Working with Data ......................................................................................................85 Chapter 5: Interacting with the User ............................................................................................99 Chapter 6: Working with Cookies ..............................................................................................113 Part II: Developing Interactive Content . . . . . . . . . . . . . . . . . . 125 Chapter 7: Maintaining Security while Working with User Input ................................................127 Chapter 8: Using Sockets ............................................................................................................153 Part III: Extending Flash and PHP . . . . . . . . . . . . . . . . . . . . . . . 189 Chapter 9: Working with Third-Party Libraries ..........................................................................191 Chapter 10: Using Object-Oriented Programming ......................................................................219 Part IV: Developing Applications . . . . . . . . . . . . . . . . . . . . . . . 237 Chapter 11: Developing Basic Applications ................................................................................239 Chapter 12: Developing Real-World Applications ......................................................................289 Chapter 13: Using Advanced Real-World Applications................................................................335 Chapter 14: Debugging Applications ..........................................................................................381 Part V: Server, Application, and Database Maintenance . . . . . . 393 Chapter 15: Maintaining an Application......................................................................................395 Chapter 16: Maintaining a Scalable and More Efficient Server ....................................................405 Chapter 17: Building Complete Advanced Applications ..............................................................429 Index ..........................................................................................................................................487

  

About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v

Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii

Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix

Part I: Understanding the Basics

  1 Chapter 1: Getting Started with Flash and PHP . . . . . . . . . . . . . . . . . 3

  Adding Apache to a Web Server ............................................................................................3 Installing Apache for Windows....................................................................................4 Installing Apache for UNIX..........................................................................................9 Modifying Apache for Windows and UNIX ..............................................................13

  Installing MySQL ................................................................................................................14 Installing MySQL for Windows..................................................................................14 Installing MySQL for UNIX ......................................................................................25 Protecting MySQL ....................................................................................................26

  Setting up PHP on the Web Server ......................................................................................27 Installing PHP for Windows ......................................................................................27 Installing PHP for UNIX ............................................................................................33

  Summary ............................................................................................................................35

  

Chapter 2: Exploring Flash and PHP . . . . . . . . . . . . . . . . . . . . . . 37

Introduction to the Web Server ..........................................................................................37 Working with .htaccess files ......................................................................................37 Protecting your content ............................................................................................38 Gathering information about Apache ........................................................................40 Using custom error documents..................................................................................42 Exploring the Basics of PHP ................................................................................................47 Understanding variables ............................................................................................47 Working with functions ............................................................................................49 Understanding control structures ..............................................................................51 Using type checking in PHP ......................................................................................56

Contents

  Exploring the Basics of MySQL ..........................................................................................57 Using statements ......................................................................................................57 Conditions ................................................................................................................58

  Exploring Flash ..................................................................................................................59 Flash IDE ..................................................................................................................59 Alternative editors ....................................................................................................61 Flash-enabled devices ................................................................................................62 Moving forward ........................................................................................................62

  Summary ............................................................................................................................62

  Chapter 3: Getting Connected . . . . . . . . . . . . . . . . . . . . . . . . . 63 Understanding Communications in Flash............................................................................63 Determining the status of PHP ..................................................................................64 Working with various connection types ....................................................................65 Connecting Flash to PHP ....................................................................................................69 Connecting PHP to MySQL ................................................................................................73 Determining the status of MySQL ............................................................................73 Connecting to MySQL ..............................................................................................74 Bringing it all together ..............................................................................................77 Summary ............................................................................................................................84 Chapter 4: Working with Data . . . . . . . . . . . . . . . . . . . . . . . . . 85 Loading Data in Flash..........................................................................................................85 Understanding the classes used to load data ..............................................................86 Putting it all together ................................................................................................87 Handling Loaded Data ........................................................................................................88 One-way loading ......................................................................................................88 Two-way loading ......................................................................................................88 Loading XML in Flash ........................................................................................................89 Working with XML in PHP..................................................................................................92 Loading XML ............................................................................................................92 Sending XML ............................................................................................................93 Loading Images Using PHP ................................................................................................95 Setting up the image loader ......................................................................................96 Summary ............................................................................................................................98 Chapter 5: Interacting with the User . . . . . . . . . . . . . . . . . . . . . . 99 Form Development Using Flash ..........................................................................................99 Creating a Contact Form ..................................................................................................101 Calling the PHP ......................................................................................................103 Contact form event handlers....................................................................................103 Mailing in PHP ........................................................................................................105 Login Module in Flash ......................................................................................................106 Code skeleton..........................................................................................................106 Login event handlers ..............................................................................................107 Server integration for login module ........................................................................110 Summary ..........................................................................................................................111

  Contents

  

Chapter 6: Working with Cookies . . . . . . . . . . . . . . . . . . . . . . . 113

Loading Cookies................................................................................................................113 Using cookies with PHP ..........................................................................................114 Using cookies in Flash ............................................................................................118 Discovering the benefits of using PHP cookies ........................................................122 Summary ..........................................................................................................................124

Part II: Developing Interactive Content 125

Chapter 7: Maintaining Security while Working with User Input . . . . . . 127 Using Caution with User Input..........................................................................................127 Safely handling file uploads ....................................................................................128 Checking for valid input..........................................................................................131 Cleaning User Data............................................................................................................132 Sanitizing the data ..................................................................................................133 Properly cleaning HTML data ..................................................................................136 Storing Data ......................................................................................................................136 Securely writing to a file ..........................................................................................137 Creating and storing a safe password using PHP ......................................................141 Returning Data ..................................................................................................................143 Securely returning data............................................................................................143 Using a more secure approach for returning data ....................................................144 Understanding the Flash Security Sandbox ......................................................................145 Setting the sandbox type..........................................................................................145 Using the sandboxType property ............................................................................145 Determining the active sandbox ..............................................................................147 Ensuring an application cannot be shared ..............................................................151 Summary ..........................................................................................................................152

Chapter 8: Using Sockets . . . . . . . . . . . . . . . . . . . . . . . . . . . 153

Understanding Sockets......................................................................................................153 Security in sockets ..................................................................................................154 Implementing a socket server ..................................................................................154 Understanding the socket connection......................................................................154 Working with Sockets in PHP............................................................................................154 Looking for command-line version of PHP ..............................................................155 Building a socket server ..........................................................................................156 Testing the socket server..........................................................................................158 Creating a persistent socket server ..........................................................................160 Working with Sockets in Flash ..........................................................................................161 Initializing a socket connection................................................................................161 Event handlers ........................................................................................................162 Remote socket connections......................................................................................163 Using a class for socket connections ........................................................................164

Contents

  Building a Chat Client with Sockets Using Flash and PHP ................................................167 PHP socket server for the chat client........................................................................167 Connecting to the socket server ..............................................................................175 Building the Flash client ..........................................................................................177

  Summary ..........................................................................................................................188

  Part III: Extending Flash and PHP 189 Chapter 9: Working with Third-Party Libraries . . . . . . . . . . . . . . . . 191 Going over Third-Party Libraries ......................................................................................191 Other types of third-party libraries ..........................................................................192 Libraries in PHP ......................................................................................................193 Installing Third-Party Libraries ........................................................................................193 Installing libraries in Flash CS3 ..............................................................................193 Installing libraries in PHP ........................................................................................195 Using Third-Party Libraries ..............................................................................................196 Working with libraries in Flash CS3 ........................................................................196 Working with Libraries in PHP ................................................................................197 Glancing at AMFPHP ........................................................................................................198 AMFPHP for AS3 and PHP Developers ....................................................................198 Testing AMFPHP with a custom service ..................................................................201 Using AMFPHP in Flash ..........................................................................................205 Building a Real-World Application Using AMFPHP ..........................................................210 AMFPHP services ....................................................................................................210 ActionScript for AMFPHP integration ......................................................................216 Summary ..........................................................................................................................218 Chapter 10: Using Object-Oriented Programming . . . . . . . . . . . . . . 219 Understanding OOP..........................................................................................................219 Overview of OOP practices......................................................................................220 Using Classes in PHP ........................................................................................................225 Importing classes in PHP ........................................................................................226 Instantiation ............................................................................................................226 Multiple classes ......................................................................................................228 Using Classes in Flash ......................................................................................................229 Importing ................................................................................................................229 Document class ......................................................................................................229 Library classes ........................................................................................................230 Using Flash and PHP to Build Custom Classes ..................................................................231 Summary ..........................................................................................................................235

  Contents

  

Part IV: Developing Applications 237

Chapter 11: Developing Basic Applications. . . . . . . . . . . . . . . . . . 239 Understanding Elements of an Application........................................................................239 Understanding application design ..........................................................................240 Finalizing the planning stage ..................................................................................242 Developing a Chat Client ..................................................................................................242 The Flash portion ....................................................................................................242 PHP for chat application..........................................................................................252 Using PHP to Develop a Photo Gallery ..............................................................................260 Developing the ActionScript ....................................................................................261 Photo gallery navigation ..........................................................................................266 PHP for the photo gallery ........................................................................................270 Using PHP to Develop an RSS Reader................................................................................274 Importing classes ....................................................................................................275 Loading the PHP......................................................................................................275 Using PHP, Flash, and MySQL to Develop a Dynamic Banner Ad ......................................279 Opening a browser window ....................................................................................281 Developing the PHP ................................................................................................283 Random selection ....................................................................................................283 Using PHP to Develop a Hit Counter ................................................................................285 Hit counter logic......................................................................................................285 Developing the Flash hit counter ............................................................................286 Summary ..........................................................................................................................287

Chapter 12: Developing Real-World Applications . . . . . . . . . . . . . . 289

Understanding Real-World Applications............................................................................289 Using PayPal in Flash ........................................................................................................290 Using POST data ....................................................................................................293 Using sendToURL ....................................................................................................294 Setting up PayPal communication............................................................................294 Using Flash and PHP to Build a Cart ................................................................................295 Designing the shopping cart ....................................................................................296 Building the PHP ....................................................................................................306 Using PHP and Flash to Build an Amazon Search Application ..........................................317 Using the Amazon Web Service ..............................................................................317 Simplifying the XML response ................................................................................319 Developing a Photo Gallery Using flickr ............................................................................326 Interfacing with the Web service..............................................................................331 Building the custom XML document ......................................................................332 Summary ..........................................................................................................................333

  Contents

  Chapter 13: Using Advanced Real-World Applications. . . . . . . . . . . . 335 Building a Drawing Application in Flash ..........................................................................335 Drawing API in Flash ..............................................................................................336 Using GD Library in PHP ..................................................................................................341 Generating an image in the GD library ....................................................................343 Gathering the pixel data in Flash ............................................................................345 Using Flash to Develop a Site Monitor ..............................................................................347 Developing the PHP for the site monitor ................................................................347 Using PHP to e-mail the administrator ....................................................................349 Developing the ActionScript for the site monitor ....................................................351 Using Flash to Develop a Video Player ..............................................................................359 Developing a Poll Application ..........................................................................................364 Building the PHP and MySQL..................................................................................364 Developing the ActionScript for the poll..................................................................368 Building a Simple File Editor ............................................................................................373 Summary ..........................................................................................................................380 Chapter 14: Debugging Applications . . . . . . . . . . . . . . . . . . . . . 381 Using Error Reporting in PHP ..........................................................................................381 Displaying errors for debugging ..............................................................................383 Understanding the error levels ................................................................................383 Debugging in Flash ..........................................................................................................385 Using an Alternative Trace ................................................................................................389 Summary ..........................................................................................................................392 Part V: Server, Application, and Database Maintenance 393 Chapter 15: Maintaining an Application . . . . . . . . . . . . . . . . . . . 395 Commenting Code ............................................................................................................395 Understanding styles for commenting code ............................................................396 Removing comments and debug helpers..................................................................399 Managing a ChangeLog ....................................................................................................399 Bug tracking ............................................................................................................399 Additional uses........................................................................................................400 Dynamic creation of changes ..................................................................................400 Managing Multiple Versions ..............................................................................................401 Version control applications ....................................................................................401 Version control support in CS3................................................................................401 Setting up version control........................................................................................402 Using Custom Libraries ....................................................................................................403 Using custom libraries with version control ............................................................403 Publishing an SWC..................................................................................................404 Summary ..........................................................................................................................404

Contents

  updateVideoTracking method..................................................................................463 Building a User Login Component in Flash ......................................................................465

  Developing the LoginWindow class ........................................................................466 Testing the login component....................................................................................473 Building the PHP login manager class......................................................................476 Adding remoting to the login component ................................................................478

  Finalizing the Video Player ................................................................................................481 Using an external library ........................................................................................482 Adding the login component ..................................................................................482

  Summary ..........................................................................................................................486

  

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487

  his book is a multipart exploration into Flash and PHP. Flash has been used for everything from basic banner ads to fully functional applications across the web and desktop.

T

  Oftentimes you can find information required to write amazing Flash applications or the server- side counterpart but rarely both. This book builds both aspects and explains the process of work- ing with PHP in your Flash projects. The first part of the book is a step-by-step walkthrough of the installation and configuration pro- cess for PHP and all the necessary components. Once the components are installed, the next step is an overview of PHP and a guide to what features and techniques you will find in the book as you continue through the chapters.

  Each chapter starts off with a basic overview and then moves quickly into the relevant information, leaving out any fluff to ensure you are getting all of the important information right away.

  Part II focuses on the importance and best practices of making your applications more secure while maintaining functionality. The topic of security is repeated throughout the various examples in this book, but this part in particular is where you will find the majority of the security information.

  Part III is extending Flash and PHP by working with various third-party applications and libraries. This chapter finishes with an overview of AMFPHP to build more-advanced and easier-to-maintain applications. Part IV takes all the previous information and walks you through the process of building complete real-world applications in Flash and PHP. These real-world applications will help you build your own custom versions and ultimately allow you to create more-advanced and dynamic applications.

Examples and Source Files

  You can find all the source code and starter files for the examples in this book on the following web site. www.wiley.com/go/flashandphpbible

Introduction

What You’ll Need

  The ActionScript used in this book is not advanced, but a basic understanding of the fundamentals would allow you to better understand the examples. The Flash Bible is a perfect complement to this book and I highly recommend it. A basic understanding of OOP practices would help you in the second portion of the book but is not required to understand the examples overall. You may want to pick up a book on advanced OOP practices to gain a more thorough understanding of the topic. The PHP used in this book is assuming a very basic understanding of the subject. This means you will not only learn the advanced topics but how to get there by starting at the beginning. PHP also allows you to develop in a class-based format, so that will be utilized in the full-application chap- ters to ensure you are building a more complete and updatable application.

  The last thing you will need is an Internet connection to download the code for the book and work with some of the third-party services. This is not used in the entire book, but to get the full experi- ence the Internet connection will be needed. That is everything you will need. Now is the time to jump in. Chapter 1 is only a few pages away.

  Understanding the Basics

  Chapter 1 Getting Started with Flash and PHP Chapter 2 Exploring Flash and PHP Chapter 3 Getting Connected Chapter 4 Working with Data Chapter 5 Interacting with the User Chapter 6 Working with Cookies

  Getting Started with Flash and PHP

  he process of getting started includes the installation and configura-

IN THIS CHAPTER

  tion of Apache, MySQL, and PHP. The examples in this book assume the installation will be done locally; however, you can modify the

  Apache installation T paths and URLs if you want to use a remote server.

  PHP installation

  The order in which you install these programs is important because they use

  MySQL installation

  paths and variables from each other, which results in the complete develop- ment environment. This installation guide covers Windows and UNIX systems. If you have decided to work from the book on an existing server, you can skip to

Chapter 2. However, there is some security and configuration information within this chapter you may find useful. Adding Apache to a Web Server The first step to working with Flash and PHP is to install the necessary com- ponents. The installation process is defined by installing Apache, then

  MySQL, and finally PHP. This order is required because PHP needs paths to Apache and MySQL in order to provide that support. You can recompile (build) any one of these components in the future. However, if you follow this installation order it will mean less work and rework in the future. The components to be installed change from time to time, but the overall installation process remains fairly constant. This means you can download

Understanding the Basics

  the latest files from their respective project sites, or to ensure all the components work together, you can obtain these files from the book’s site. You should have a basic understanding of the system on which you will be installing. It is impor- tant to run a development system in a secured location. The best setup is a computer behind a physical firewall or on an internal network. If this is not possible, simply configure Apache to not allow remote connections and you can change the port number to hide it on your network.

  Development systems can require more advanced configuration depending on how they NOTE NOTE have been set up. You can find common issues explained on the book’s Web site.

  Installing Apache for Windows

  Once you determine on which system you are installing the development system you can begin to download the necessary components. It is recommended that you use the files provided with the book. I also provide the necessary locations to download the latest files. Access the latest version from Apache’s Web site. It is easier to install from the binary installer ver- sion rather than compiling the source. However, compiling from source does offer a higher level of customization and allows you to understand what is running under the hood.

  Building from source is not for the beginner. It does require a certain level of experience CAUTION CAUTION and is only recommended to those who truly feel up to the challenge.

  The latest Windows binary installer files for Apache can be found at www.apache.org/dyn/closer.cgi/httpd/binaries/win32/ .