You are previewing Sams Teach Yourself PHP, MySQL® and Apache All in One.
O'Reilly logo
Sams Teach Yourself PHP, MySQL® and Apache All in One

Book Description

A new edition of the best selling book that covers three popular open-source tools in one complete Starter Kit package.

  • Revised and updated to reflect major changes in new versions of PHP, MySQL, and PHP 5.

  • Carefully steps the reader through the basic set up of PHP, MySQL, and Apache, and shows how to combine these technologies to quickly create simple interactive Web applications.

  • CD-ROM allows the reader to install a safe, foolproof learning environment for either a Windows or Linux-based PC.

  • Table of Contents

    1. Copyright
    2. About the Authors
    3. Acknowledgments
    4. We Want to Hear from You!
    5. Reader Services
    6. Introduction
    7. Laying the Groundwork
      1. Installing and Configuring MySQL
        1. Current and Future Versions of MySQL
        2. How to Get MySQL
        3. Installing MySQL on Linux/Unix
        4. Installing MySQL on Windows
        5. Troubleshooting Your Installation
        6. Basic Security Guidelines
        7. Introducing the MySQL Privilege System
        8. Working with User Privileges
        9. Summary
        10. Q&A
        11. Workshop
      2. Installing and Configuring Apache
        1. Current and Future Versions of Apache
        2. Choosing an Installation Method
        3. Installing Apache on Linux/Unix
        4. Installing Apache on Windows
        5. Apache Configuration File Structure
        6. Apache Log Files
        7. Apache-Related Commands
        8. Starting Apache for the First Time
        9. Troubleshooting
        10. Summary
        11. Q&A
        12. Workshop
      3. Installing and Configuring PHP
        1. Current and Future Versions of PHP
        2. Building PHP on Linux/Unix with Apache
        3. Installing PHP Files on Windows
        4. php.ini Basics
        5. Testing Your Installation
        6. Getting Installation Help
        7. The Basics of PHP Scripts
        8. Summary
        9. Q&A
        10. Workshop
    8. PHP Language Structure
      1. The Building Blocks of PHP
        1. Variables
        2. Data Types
        3. Operators and Expressions
        4. Constants
        5. Summary
        6. Q&A
        7. Workshop
      2. Flow Control Functions in PHP
        1. Switching Flow
        2. Loops
        3. Code Blocks and Browser Output
        4. Summary
        5. Q&A
        6. Workshop
      3. Working with Functions
        1. What Is a Function?
        2. Calling Functions
        3. Defining a Function
        4. Returning Values from User-Defined Functions
        5. Variable Scope
        6. Saving State Between Function Calls with the static Statement
        7. More About Arguments
        8. Testing for the Existence of a Function
        9. Summary
        10. Q&A
        11. Workshop
      4. Working with Arrays and Objects
        1. What Is an Array?
        2. Creating Arrays
        3. Some Array-Related Functions
        4. Creating an Object
        5. Object Inheritance
        6. Summary
        7. Q&A
        8. Workshop
    9. Getting Involved with the Code
      1. Working with Strings, Dates, and Times
        1. Formatting Strings with PHP
        2. Investigating Strings in PHP
        3. Manipulating Strings with PHP
        4. Using Date and Time Functions in PHP
        5. Summary
        6. Workshop
      2. Working with Forms
        1. Creating a Simple Input Form
        2. Accessing Form Input with User-Defined Arrays
        3. Combining HTML and PHP Code on a Single Page
        4. Using Hidden Fields to Save State
        5. Redirecting the User
        6. Sending Mail on Form Submission
        7. Working with File Uploads
        8. Summary
        9. Workshop
      3. Working with User Sessions
        1. Session Function Overview
        2. Starting a Session
        3. Working with Session Variables
        4. Passing Session IDs in the Query String
        5. Destroying Sessions and Unsetting Variables
        6. Summary
        7. Q&A
        8. Workshop
      4. Working with Files and Directories
        1. Including Files with include()
        2. Testing Files
        3. Creating and Deleting Files
        4. Opening a File for Writing, Reading, or Appending
        5. Reading from Files
        6. Writing or Appending to a File
        7. Working with Directories
        8. Summary
        9. Q&A
        10. Workshop
      5. Working with the Server Environment
        1. Opening Pipes to and from Processes Using popen()
        2. Running Commands with exec()
        3. Running Commands with system() or passthru()
        4. Summary
        5. Q&A
        6. Workshop
      6. Working with Images
        1. Understanding the Image-Creation Process
        2. Necessary Modifications to PHP
        3. Drawing a New Image
        4. Getting Fancy with Pie Charts
        5. Modifying Existing Images
        6. Summary
        7. Q&A
        8. Workshop
    10. PHP and MySQL Integration
      1. Learning the Database Design Process
        1. The Importance of Good Database Design
        2. Types of Table Relationships
        3. Understanding Normalization
        4. Following the Design Process
        5. Summary
        6. Q&A
        7. Workshop
      2. Learning Basic SQL Commands
        1. Learning the MySQL Data Types
        2. Learning the Table Creation Syntax
        3. Using the INSERT Command
        4. Using the SELECT Command
        5. Using WHERE in Your Queries
        6. Selecting from Multiple Tables
        7. Using the UPDATE Command to Modify Records
        8. Using the REPLACE Command
        9. Using the DELETE Command
        10. Frequently Used String Functions in MySQL
        11. Using Date and Time Functions in MySQL
        12. Summary
        13. Q&A
        14. Workshop
      3. Interacting with MySQL Using PHP
        1. Connecting to MySQL with PHP
        2. Working with MySQL Data
        3. Summary
        4. Workshop
    11. Basic Projects
      1. Managing a Simple Mailing List
        1. Developing the Subscription Mechanism
        2. Developing the Mailing Mechanism
        3. Summary
        4. Q&A
        5. Workshop
      2. Creating an Online Address Book
        1. Planning and Creating the Database Tables
        2. Creating a Menu
        3. Creating the Record Addition Mechanism
        4. Viewing Records
        5. Creating the Record Deletion Mechanism
        6. Adding Subentries to a Record
        7. Summary
        8. Workshop
      3. Creating a Simple Discussion Forum
        1. Designing the Database Tables
        2. Creating the Input Forms and Scripts
        3. Displaying the Topic List
        4. Displaying the Posts in a Topic
        5. Adding Posts to a Topic
        6. Summary
      4. Creating an Online Storefront
        1. Planning and Creating the Database Tables
        2. Displaying Categories of Items
        3. Displaying Items
        4. Summary
        5. Workshop
      5. Creating a Shopping Cart Mechanism
        1. Planning and Creating the Database Tables
        2. Integrating the Cart with Your Storefront
        3. Payment Methods and the Checkout Sequence
        4. Summary
        5. Workshop
      6. Creating a Simple Calendar
        1. Building a Simple Display Calendar
        2. Creating a Calendar Library
        3. Summary
        4. Q&A
        5. Workshop
      7. Restricting Access to Your Applications
        1. Authentication Overview
        2. Apache Authentication Module Functionality
        3. Using Apache for Access Control
        4. Combining Apache Access Methods
        5. Limiting Access Based on HTTP Methods
        6. Introducing Cookies
        7. Setting a Cookie with PHP
        8. Restricting Access Based on Cookie Values
        9. Summary
        10. Q&A
        11. Workshop
      8. Logging and Monitoring Web Server Activity
        1. Standard Apache Access Logging
        2. Standard Apache Error Logging
        3. Managing Apache Logs
        4. Logging Custom Information to a Database
        5. Summary
        6. Q&A
        7. Workshop
      9. Application Localization
        1. About Internationalization and Localization
        2. About Character Sets
        3. Environment Modifications
        4. Creating a Localized Page Structure
        5. Summary
        6. Q&A
        7. Workshop
    12. Administration and Fine Tuning
      1. Apache Performance Tuning and Virtual Hosting
        1. Scalability Issues
        2. Load Testing with ApacheBench
        3. Proactive Performance Tuning
        4. Preventing Abuse
        5. Implementing Virtual Hosting
        6. Summary
        7. Q&A
      2. Setting Up a Secure Web Server
        1. The Need for Security
        2. The SSL Protocol
        3. Obtaining and Installing SSL Tools
        4. Managing Certificates
        5. SSL Configuration
        6. Summary
        7. Q&A
      3. Optimizing and Tuning MySQL
        1. Building an Optimized Platform
        2. MySQL Startup Options
        3. Optimizing Your Table Structure
        4. Optimizing Your Queries
        5. Using the FLUSH Command
        6. Using the SHOW Command
        7. Summary
        8. Q&A
        9. Workshop
      4. Software Upgrades
        1. Staying in the Loop
        2. Upgrading MySQL
        3. Upgrading Apache
        4. Upgrading PHP
        5. Summary
        6. Workshop
    13. Looking Toward the Future
      1. Features and Backward Compatibility of PHP 5.0
        1. What's Wrong With PHP 4?
        2. The New Object Model
        3. Additional New Features
        4. So, When Should I Upgrade to PHP 5?
        5. Summary
        6. Q&A
      2. Features and Backward Compatibility of MySQL 4.1
        1. Using Subqueries
        2. Internationalization Enhancements
        3. Additional New Functionality
        4. Looking Further Ahead to MySQL 5.0
        5. Summary
        6. Q&A
        7. Workshop
    14. Appendix
      1. Installing MySQL, Apache, and PHP from the CD-ROM
        1. Linux/Unix Installation
        2. Windows Installation
        3. Troubleshooting
    15. Index