Beginning PHP5, Apache, and MySQL Web Development doc

819 926 0
Beginning PHP5, Apache, and MySQL Web Development doc

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

www.it-ebooks.info Beginning PHP5, Apache, and MySQL ® Web Development Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz, Michael K. Glass 01_579665 ffirs.qxd 12/30/04 8:08 PM Page iii www.it-ebooks.info 01_579665 ffirs.qxd 12/30/04 8:08 PM Page ii www.it-ebooks.info Beginning PHP5, Apache, and MySQL ® Web Development 01_579665 ffirs.qxd 12/30/04 8:08 PM Page i www.it-ebooks.info 01_579665 ffirs.qxd 12/30/04 8:08 PM Page ii www.it-ebooks.info Beginning PHP5, Apache, and MySQL ® Web Development Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz, Michael K. Glass 01_579665 ffirs.qxd 12/30/04 8:08 PM Page iii www.it-ebooks.info Beginning PHP5, Apache, and MySQL ® Web Development Published by Wiley Publishing, Inc. 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Copyright © 2005 by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada ISBN: 0-7645-7966-5 Manufactured in the United States of America 10 9 8 7 6 5 4 3 2 1 1B/SQ/QR/QV/IN 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, e-mail: brandreview@wiley.com. 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 PARTIC- ULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMO- TIONAL 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 PRO- FESSIONAL 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 DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ. 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. Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books. Library of Congress Cataloging-in-Publication Data available from the publisher. Trademarks: Wiley, the Wiley Publishing logo, Wrox, the Wrox logo, Programmer to Programmer, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affil- iates, in the United States and other countries, and may not be used without written permission. MySQL is a registered trademark of MySQL AB Limited Company. All other trademarks are the prop- erty of their respective owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book. 01_579665 ffirs.qxd 12/30/04 8:08 PM Page iv www.it-ebooks.info About the Authors Elizabeth Naramore Elizabeth graduated from Miami University (Ohio) with a degree in Organizational Behavior and has been a Web developer since 1997. Her main focus is in e-commerce, but she develops sites across numer- ous industries. She is currently a moderator at PHPBuilder.com, an online help center for PHP. She lives in Cincinnati, Ohio with her husband and two children, and looks forward to someday returning to Miami to get her Masters in Computer Science. Thanks to my husband and soul mate who continues to be supportive of everything I do, and who inspires me to always do a little better. Thanks to my children who make me understand the importance of looking outside the box and keeping my sense of humor, and for making me proud to be a mom. Also, thank you to Debra for always keeping us on track, and for having faith in us. Jason “goldbug” Gerner Jason currently spends his days working as a Web developer in Cincinnati and burns free time com- plaining about lack of support for Web standards and abusing XML. He can often be found lurking in the PHPBuilder.com discussion forums, waiting to chime in with nagging comments about CSS or code efficiency. Yann “Bunkermaster” Le Scouarnec Yann is the senior developer for Jolt Online Gaming, a British gaming company. He is a moderator at PHPBuilder.com and a developer of open source PHP software for the gaming community. He has also worked for major software corporations as a software quality expert. I thank all the innocent bystanders who got pushed around because of this project: Debra and Nancy, who were patient enough not to have homicidal thoughts; and my wife and kids, who barely saw me for six months. Jeremy “stolzyboy” Stolz Jeremy is a Web Developer at J&M Companies, Inc. (www.jmcompanies.com), a print company in Fargo, North Dakota. Jeremy is primarily a PHP/MySQL developer, but he has also worked with many other languages. When not working, he frequents the Internet and tries to keep his programming skills sharp and up to date. He is a contributor to and moderator at PHPBuilder.com. I’d like to thank my wife, my baby daughter, and the rest of my family for being patient with me while working on this project. 01_579665 ffirs.qxd 12/30/04 8:08 PM Page v www.it-ebooks.info Michael “BuzzLY” Glass Michael Glass has been a gladiator in the software/Web site development arena for more than eight years. He has more than ten years of commercial programming experience with a wide variety of tech- nologies, including PHP, Java, Lotus Domino, and Vignette StoryServer. He divides his time between computer programming, playing pool in the APA, and running his Web site at www.ultimatespin.com. You can usually find him slinking around on the PHPBuilder.com forums, where he is a moderator with the nickname BuzzLY. Thanks, Staci, for putting up with long and late hours at the computer. Elizabeth and Jason, it wouldn’t have been the same project without you two. And thanks to my code testers at www.ultimatespin.com: Spidon, Kaine, Garmy, Spidermanalf, Ping, Webhead, and FancyDan. You guys rock! To Donna and Gerry, who have influenced my life more than they can ever know, and who taught me the importance of finishing what you’ve started. 01_579665 ffirs.qxd 12/30/04 8:08 PM Page vi www.it-ebooks.info Credits Acquisitions Editor Debra Williams Cauley Development Editor Brian MacDonald Senior Production Editor Angela Smith Technical Editor Jason Gerner Copy Editor Kim Cofer Editorial Manager Mary Beth Wakefield Vice President & Executive Group Publisher Richard Swadley Vice President and Publisher Joseph B. Wikert Project Coordinator Erin Smith Graphics and Production Specialists Carrie A. Foster Denny Hager Jennifer Heleine Quality Control Technician Brian H. Walls Proofreading and Indexing TECHBOOKS Production Services 01_579665 ffirs.qxd 12/30/04 8:08 PM Page vii www.it-ebooks.info [...]... heredoc Alternates to Incrementing/Decrementing Values OOP Dreams 79 79 79 A Brief OOP Example Why Use OOP? 80 82 Summary Exercises 82 82 Chapter 3: Using PHP5 with MySQL Overview of MySQL Structure and Syntax MySQL Structure 85 85 86 Field Types Choosing the Right Field Type null/not null Indexes Unique Auto Increment Other Parameters Types of MySQL Tables and Storage Engines MySQL Syntax and Commands... book, you will be able to create a well-designed, dynamic Web site using tools available for free Although this book is not intended to be a detailed analysis of Apache, PHP, and MySQL, it points you in the right direction to explore further issues you may wish to delve into Brief Intro to PHP, Apache, MySQL, and Open Source PHP, Apache, and MySQL are all part of the open source group of software programs... Exercise Chapter 9: Handling and Avoiding Errors How the Apache Web Server Deals with Errors Apache’s ErrorDocument Directive Apache’s ErrorDocument: Advanced Custom Error Page Error Handling and Creating Error Handling Pages with PHP Error Types in PHP Generating PHP Errors 203 208 214 218 220 225 225 227 227 228 229 239 250 250 251 251 252 256 260 260 261 Other Methods of Error Handling Exceptions... role each of these programs (Apache, MySQL, and PHP) plays in creating your Web site Imagine that your dynamic Web site is a fancy restaurant Diners come to your place, and each one wants something different and specific They don’t worry so much about how the food is prepared, as long as it looks and tastes delicious Unlike a buffet-type spread, where everything is laid out and your patrons simply choose... Windows systems only Along with Apache, PHP, and MySQL, the package includes Perl and phpMyAdmin (another powerful database administration system we discuss in Chapter 3) XAMPP XAMPP, available at http://sourceforge.net/projects/xampp, is an open source installer that will install Apache, MySQL, PHP, Perl, phpMyAdmin, and an FTP server It is suitable for Linux, Solaris, and Windows systems Configuring... your Web site visitor You will also get experience in error handling and data validation while working on this site ❑ Comic Book Fan Web site The creation of this Web site takes you through the steps of building databases from scratch, manipulating images and sending out e-mails using PHP, authenticating users, managing content through CMS, creating a mailing list, setting up an e-commerce section, and. .. Configuring Your Installation You’ve spent your hard-earned money and purchased this book, so you undoubtedly know the enormous benefits of using PHP, Apache, and MySQL together to create your Web site But in case you found this book on your desk one Monday morning with a sticky note reading “Learn this!,” this chapter looks at the basics of PHP, MySQL, and Apache to show you what makes the “AMP” combination... Installation Configuring PHP5 to Use MySQL 13 14 16 Configuring Your MySQL Installation Testing Your Installation Configuring Your Installation 17 17 19 The my.cnf File Setting Up Users and Privileges Where to Go for Help and Other Valuable Resources Help within the Programs Source Web Sites 21 24 25 25 25 Summary 26 www.it-ebooks.info Contents Part II: Movie Review Web Site 27 Chapter 2: Creating PHP... is live and running, because your settings may differ from those on your Webhosting company’s server Even a small difference can cause you big headaches Apache Apache acts as your Web server Its main job is to parse any file requested by a browser and display the correct results according to the code within that file Apache is quite powerful and can accomplish virtually any task that you, as a Webmaster,... most common uses and functions of PHP, you can find a complete list of PHP functions in Appendix B of this book As you continue to program in PHP and your comfort level increases (or the demands of your boss grow), we encourage you to expand your use of built-in PHP functions to take advantage of its tremendous power You can download the PHP software from PHP’s Web site at www.php.net MySQL Another open . www.it-ebooks.info Beginning PHP5, Apache, and MySQL ® Web Development Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec,. iii www.it-ebooks.info 01_579665 ffirs.qxd 12/30/04 8:08 PM Page ii www.it-ebooks.info Beginning PHP5, Apache, and MySQL ® Web Development 01_579665 ffirs.qxd 12/30/04 8:08 PM Page i www.it-ebooks.info 01_579665

Ngày đăng: 23/03/2014, 00:20

Từ khóa liên quan

Mục lục

  • Beginning PHP5, Apache, and MySQL Web Development - Elizabeth Naramore et al. - Wiley Publishing - 2005 - ISBN 0-7645-7966-5

  • Contents

  • Part I: Getting Started

    • Chapter 1: Configuring Your Installation

      • Projects in This Book

      • Brief Intro to PHP, Apache, MySQL, and Open Source

        • A Brief History of Open Source Initiatives

        • Why Open Source Rocks

        • How the Pieces of the AMP Module Work Together

          • Apache

          • PHP

          • MySQL

          • AMP Installers

          • Foxserv

          • PHPTriad

          • XAMPP

          • Configuring Your Apache Installation

            • Testing Your Installation

            • Customizing Your Installation

            • Adding PHP to the Equation

            • Document Root

            • Configuring Your PHP Installation

              • Testing Your Installation

              • Customizing Your Installation

              • Configuring PHP5 to Use MySQL

              • Configuring Your MySQL Installation

                • Testing Your Installation

Tài liệu cùng người dùng

Tài liệu liên quan