Sams Teach Yourself PHP, MySQL and Apache All in One and over one million other books are available for Amazon Kindle. Learn more

Vous voulez voir cette page en français ? Cliquez ici.

Sign in to turn on 1-Click ordering.
More Buying Choices
Have one to sell? Sell yours here
Start reading Sams Teach Yourself PHP, MySQL and Apache All in One on your Kindle in under a minute.

Don't have a Kindle? Get your Kindle here, or download a FREE Kindle Reading App.

Sams Teach Yourself PHP, MySQL and Apache All in One (4th Edition) [Paperback]

Julie Meloni
2.0 out of 5 stars  See all reviews (1 customer review)
List Price: CDN$ 41.99
Price: CDN$ 26.45 & FREE Shipping. Details
You Save: CDN$ 15.54 (37%)
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
Usually ships within 13 days.
Ships from and sold by Gift-wrap available.


Amazon Price New from Used from
Kindle Edition CDN $16.80  
Paperback CDN $26.45  
Save Up to 90% on Textbooks
Hit the books in's Textbook Store and save up to 90% on used textbooks and 35% on new textbooks. Learn more.
There is a newer edition of this item:
Sams Teach Yourself PHP, MySQL and Apache All in One (5th Edition) Sams Teach Yourself PHP, MySQL and Apache All in One (5th Edition) 1.0 out of 5 stars (1)
CDN$ 26.32
Usually ships in 2 to 4 weeks
Join Amazon Student in Canada

Book Description

June 18 2008 067232976X 978-0672329760 4

In just a short time, you can learn how to use PHP, MySQL, and Apache together to create dynamic, interactive websites and applications using the three leading open-source web development technologies.


Using a straightforward, step-by-step approach, each lesson in this book builds on the previous ones, enabling you to learn the essentials of PHP scripting, MySQL databases, and the Apache web server from the ground up.


Regardless of whether you run Linux, Windows, or Mac OS X, the enclosed CD includes a complete starter kit that lets you install all the software you need to set up a stable environment for learning, testing, and production.


Learn how to…

  • Install, configure, and set up the PHP scripting language, the MySQL database system, and the Apache Web server
  • Get these technologies to work together to create a dynamic, database-backed website
  • Interact with MySQL using PHP
  • Work with forms and files
  • Create a web-based discussion forum or mailing list
  • Add a storefront and shopping cart to your site
  • Optimize your MySQL databases
  • Fine-tune the Apache server’s performance
  • Restrict access to your applications
  • Set up a secure web server


CD-ROM Includes

  • A complete PHP, MySQL, and Apache starter kit for Windows®, Linux®, or Mac® OS X.


Customers Who Bought This Item Also Bought

Product Details

Product Description

About the Author

Julie C. Meloni is the technical director for i2i Interactive (, a multimedia company located in Los Altos, California. She has been developing web-based applications since the Web first saw the light of day and remembers the excitement surrounding the first GUI web browser. She has authored numerous books and articles on web-based programming

languages and database topics, and you can find translations of her work in 15 different languages. She is also a fervent blogger and is the author of Sams Teach Yourself Blogging in a Snap. Most days, Julie can be found wandering the halls of Avery Hall on the campus of Washington State University, where she is a Ph.D. student in English who is quite interested in digital/social scholarship in the humanities.

Excerpt. © Reprinted by permission. All rights reserved.



Welcome to Sams Teach Yourself PHP, MySQL and Apache All in One, Fourth Edition! In the previous edition, the majority of the modifications were around the ability to use both PHP 5 and MySQL 5 as core technologies. In the two years since the previous edition was released, little has changed: PHP 5 and MySQL 5 are solid, stable, and power a great number of the Web-based applications we use every day. Many hosting providers now offer PHP 5 by default, without support for PHP 4 (which has entered the "end of life" phase), thus ensuring that anyone who wants to use PHP 5 and MySQL 5 can do so without installing these applications on their own (although the first four chapters of this book explain how to do just that). All the code in this edition is based on PHP 5 and, where appropriate, the MySQL Improved Extension (mysqli) in PHP, using MySQL 5 as the back-end database.

Some of you might have heard of PHP 6 or have seen books touting PHP 6 as the core language used. As of this writing in May of 2008, PHP 6 is still in the development stages and has not even entered the release candidate stage of development. Although PHP 6 is likely to reach the release candidate stage before the end of 2008, hosting providers will be loath to provide new technologies for general use until the language and the engine driving it have been thoroughly tested and improved to the point at which the release is deemed stable and mature—perhaps sometime in 2009. Given this information, it seemed entirely premature for this edition to cover the aspects of the language based on a developmental release, especially when the goal of this book is to provide the concepts necessary to master the basics of programming in the PHP language—the version that is stable and widely distributed.

Over the course of this book, you'll learn the concepts necessary for configuring and managing the Apache web server, the basics of programming in PHP, and the methods for using and administering the MySQL relational database system. The overall goal of the book is to provide you with the foundation you need to understand how seamlessly these technologies integrate with one another and to give you practical knowledge of how to integrate them.

Who Should Read This Book?

This book is geared toward individuals who possess a general understanding of the concepts of working in a web-based development environment, be it Linux/UNIX, Windows, or even Mac OS X. Installation and configuration instructions assume that you have familiarity with your operating system and the basic methods of building (on Linux/UNIX systems) or installing (on Windows and Mac OS X systems) software.

The lessons that delve into programming with PHP assume no previous knowledge of the language. However, if you have experience with other programming languages, such as ASP (Active Server Pages), JSP (Java Server Pages), or Perl, you will find the going much easier. Similarly, if you have worked with other databases, such as Oracle or Microsoft SQL Server, you will already possess a solid foundation for working through the MySQL-related lessons.

The only real requirement is that you already understand static web content creation with HTML. If you are just starting out in the world of web development, you will still be able to use this book, but you should consider working through an HTML tutorial. If you are comfortable creating basic pages, you will be fine.

How This Book Is Organized

This book is divided into six parts, corresponding to particular topic groups. You should read the chapters within each part one right after another, with each chapter building on the information found in those before it:

  • Part I, "Getting Up and Running," provides a quick start guide to installation and walks you through the installation and configuration of MySQL, Apache, and PHP in depth. You'll need to complete at least one version of these instructions—either the quick start installation or the longer instructions—before moving on unless you already have access to a working installation of these technologies through a hosting provider. Even if you don't need to install and configure MySQL, Apache, and PHP in your development environment, you should still skim these lessons so that you understand the basics of their interaction.

  • Part II, "PHP Language Structure," is devoted to teaching you the basics of the PHP language, including structural elements such as arrays and objects. The examples will get you in the habit of writing code, uploading it to your server, and testing the results.

  • Part III, "Getting Involved with the Code," consists of chapters that cover intermediate-level application development topics, including working with forms and files, restricting access, and completing other small projects designed to introduce a specific concept.

  • Part IV, "PHP and MySQL Integration," contains chapters devoted to working with databases in general, such as database normalization, as well as using PHP to connect to and work with MySQL. Included is a basic SQL primer, which also includes MySQL-specific functions and other information.

  • Part V, "Basic Projects," consists of chapters devoted to performing a particular task using PHP and MySQL, integrating all the knowledge gained so far. Projects include an address book, a discussion forum, and a basic online storefront, among others. These examples are built in a black-and-white environment, meaning the aesthetic display is minimal. This allows you to focus on the programming and logic involved in building the structures rather than making these items aesthetically pleasing.

  • Part VI, "Administration and Fine-Tuning," is devoted to administering and tuning Apache and MySQL. It also includes information on virtual hosting and setting up a secure web server.

If you find that you are already familiar with a topic, you can skip ahead to the next chapter. However, in some instances, chapters refer to specific concepts learned in previous chapters, so be aware that you might have to skim a skipped chapter so that your development environment remains consistent with the book.

At the end of many chapters, a few quiz questions test how well you've learned the material. Additional activities provide another way to apply the information learned in the chapter and guide you toward using this newfound knowledge in the next chapter.

About the Book's Source Code

All of the code that appears in listings throughout the chapters is also available on the accompanying CD-ROM. You may also download the source code bundle from the author's website at

Typing the code on your own provides useful experience in making typos, causing errors, and performing the sometimes mind-numbing task of tracking down errant semicolons. However, if you want to skip that lesson and just upload the working code to your website, feel free!

Conventions Used in This Book

This book uses different typefaces to differentiate between code and plain English, and to help you identify important concepts. Throughout the chapters, code, commands, and text you type or see onscreen appear in a computer typeface. New terms appear in italics at the point in the text where they are defined. Additionally, icons accompany special blocks of information:

Note - A "By the Way" note presents an interesting piece of information related to the current topic.

Tip - A "Did You Know" tip offers advice or teaches an easier method for performing a task.

Caution - A "Watch Out!" warns you about potential pitfalls and explains how to avoid them.

© Copyright Pearson Education. All rights reserved.

Inside This Book (Learn More)
Browse Sample Pages
Front Cover | Copyright | Table of Contents | Excerpt | Index
Search inside this book:

Customer Reviews

5 star
4 star
3 star
1 star
2.0 out of 5 stars
2.0 out of 5 stars
Most helpful customer reviews
0 of 1 people found the following review helpful
2.0 out of 5 stars Sadly, it's hard Oct. 18 2008
I bought this book in hopes of learning PHP and MySQL. However, the book is quite confusing from the start of installing the different programs etc. Honestly, it's not a book for beginners, but for people who have an idea the difference between an array and a function. Yes, I'm using the terms. The author does a good job of breaking things down into more manageable pieces, but it can be hard to follow along and see just what the next step is.

All in all, if you're new to coding, I suggest that you search for another book that will help you on your way and then pick this up later for some additional resources.
Was this review helpful to you?
Most Helpful Customer Reviews on (beta) 3.8 out of 5 stars  19 reviews
10 of 11 people found the following review helpful
4.0 out of 5 stars Recommended for Beginners Nov. 30 2008
By F. M. Bobbitt - Published on
In 1978, I built two Heath Kit computers so that I could better understand what a computer was and how it worked because I had been unexpectedly assigned as the project manager for automating a very large manual process. Until then, I had only a vague notion that they existed, and I knew I was in trouble. I also taught myself to program proficiently in 4 languages: FORTRAN, Basic, PASCAL, and NATURAL as well as JPL.

Since then, I have kept up with the technology on the business side and I still build all of my new computers. But I let my programming and system admin skills atrophy over the years.

A couple of weeks ago, and now 62 years old, I decided to pick up where I left off many years ago but developing a dynamic web site using Apache Server, MySQL and Access, Info Path, and PHP. I also plan to explore CGI, and evaluate the pros and cons of APS and APS.NET, but that's a different project for a couple of months from now.

I found the opening chapters of the book to be easy to follow. The open source software for Apache, MySQL, and PHP on the CD that came with the book can certainly be used effectively, but I found that newer version of all three applications were available for downloading from the Web--all free, of course--and the instructions in the book work just fine for the newer versions of the software.

I was able to install the Apache server, MySQL, and PHP on a development computer (i.e., localhost or had everything working and a basic HTML only web page developed on Dreamweaver CS4 in about an hour.

This is fine for me because I intend to use a web site hosting service and so I only need to develop and test on my local computer and then upload everything to my ISP site.

If you intend to run your own dedicated web server and you are a beginner, you will need to pick up another reference book to learn how to obtain a static IP address and set up a web server. It's not hard, but this book won't be of much help. Try one of the "Building a Web Site for Dummies" books on setting up a web server at home or work. Be careful, though, because there are several still being sold and you want to be sure you purchase the newest version. I accidentally purchased an old version and ended up having to take it back to exchange it for a newer book.

Once you are up and running, the book takes you through descriptions and projects for writing basic PHP scripts, then it shows you how to use PHP to integrate MySQL (the chapters that were of the most benefit for me), and finally it ends with how to administer the Apache server.

If you have never done any programming before, then you might find the PHP a bit daunting at first. It was easy for me because even though I haven't done any serious programming since 1982, the basics for functions, procedures, calls, declaring variables, strings, data types,et al hasn't changed much in 26 years.

The same was true for MySQL. I have had experience on the business side creating relational databases and the NATURAL language that I taught myself in 1978 was either the precursor to SQL or it was an early competitor because the MySQL query language was virtually the same as that used in NATURAL. Therefore, while I'm very rusty in my programming skills, understanding the basics in the book probably came easier for me that it would for someone who had no previous programming or query writing experience.

Not to worry thought. I was an infantry officer in the US Marine Corps in 1978 and had spent the first 10 years of my career leading Marines in combat and in infantry units. My first actual staff officer assignment at a major headquarters was the Project Officer responsible for automating the Marine Corps' officer assignment system. At that time, I had no idea what a computer was and I had no idea why the Marine Corps would assign someone like me to a technical position that obviously required expert knowledge in developing advanced custom computer software and custom outputs to optimize the assignment of all officers in the Marine Corps. Frankly, I would have preferred serving another couple of years in combat armed with only a Swiss Army Knife over working with computers.

What's my point? If you are new to programming and databases, don't let it intimidate you. If an old war horse like me can do it, you can probably do it faster and better. If you don't know a variable from a data type or the difference between functions, arrays, and objects; just stick with it and just when you think you'll never understand it, a light will come on and you'll make a big leap forward and the pieces will begin to fall into place more quickly as you make progress.

The examples in the book are easy (harder for a complete novice), but as one previous reviewer pointed out, there are a few errors in the sample code that will cause you to think that you are doing something wrong.

The key is to work through all of the examples. If you have followed the instructions precisely and you example project still doesn't work, then you have hit one of the unreported errors. I suggest you go on to the next project in the book, or take the previous review up on his offer to email you the corrections.

If you are a complete novice and don't know a web site from a construction site, then I suggest reading the "for Dummies" books for building web sites and developing web pages. There are a number of good free and inexpensive web page editors that you can use. I suggest trying out the free version to get a feel for what's involved and then deciding where you want to go from there. If you are just interested in a web site with a few personal pages on it, then high end web page editors and this book are definitely overkill. If you find that you are interested in developing more complex dynamic web sites, then this book will help you get started on the web server side and I would recommend that you consider purchasing the Adobe Dreamweaver CS4 web page editor. But be forewarned--Dreamweaver is expensive and the learning curve can be steep, so make sure that you really want to put the money and effort into web page development before you go the high end route.

I have one final comment. If you are already using Microsoft's Access database, then you may want to skip the MySQL part of the book. Integrating Access is not hard, but you'll have to download the ODBC connector for PHP (it's free) and you may have to search the Internet for a little help on how to do the integration, but it's basically the same as integrating MySQL. Since I want to use Microsoft's Info Path to cut some of my development time, I intend to use both MySQL and Access.

Enjoy the journey.
3 of 3 people found the following review helpful
2.0 out of 5 stars Do not put examples in the real world! March 8 2009
By Alan Miller - Published on
I was overall unimpressed with the book. I found that there was too much time on trivialities (such as the variety of string operations spread over multiple pages) that could've been on 1-2 pages with references to the official manuals.

There was also no mention at all of critically important areas such as basic SQL injection and input filtering - all of the "sample projects" in the book are pretty much wide-open to very simple injection attacks, and the book and projects provide enough of a background for beginners to build simple useful applications with absolutely no clue that they might be doing anything wrong.
2 of 2 people found the following review helpful
4.0 out of 5 stars Great for beginning May 14 2009
By Mathew Thompson - Published on
This book is a beginner's book that requires absolutely no prior knowledge or experience in PHP/MySQL/Apache to use. I bought this book while completely new to the Linux environment. I want to point out that I used Debian and "aptitude install", so I skipped chapters 1-4. I read chapters 5-18 and glanced at chapters 19-27.

As a complete beginner to server side coding, I found this book to be everything I needed to get started with PHP and MySQL. Before I was even finished reading, I had already created 20-30 different PHP scripts apart from the examples in the book with different, but useful functions and was already developing and coding a journal web page.

The subjects in the book are definitely rudimentary in nature, but the author gives an appropriate amount of time to all subjects that helped me became far more independent a coder. This is compared to other beginner's books that tend to have far more subjects at the expensive of ample descriptions leaving me, the reader, confused. Unfortunately, this book, sometimes, falls into this trap as some sets of code require more diligence in reading than others, but never gets to the point where the code is indecipherable or full of functionality that hasn't been fleshed out or explained at all.

In the end, I found this book to be everything I needed to get started with PHP. I still keep the book handy as reference for my projects.
2 of 2 people found the following review helpful
5.0 out of 5 stars Organization is key Jan. 28 2009
By W. Daitchman - Published on
Format:Paperback|Verified Purchase
Julie Meloni's instructional "Teach Yourself PHP, MySQL and Apache " is a well organized manual that gets you up and running quickly. The book and accompanying CD provide everything necessary to install a local Apache server, MySQL database and PHP. As a PHP beginner, I began writing scripts almost immediately. Thanks to a straightforward explanation of the basics, especially syntax, constructing error-free code has been demystified. The book lets you take web development to the next level.
2 of 2 people found the following review helpful
3.0 out of 5 stars Problem with mysqli Nov. 3 2008
By Alan M - Published on
Format:Paperback|Verified Purchase
I like this book overall but with one major caveat. The versions of PHP and Mysql included on the cd-rom do not work together. Specifically, the version of PHP included on the CD-ROM does not include support for the mysqli family of commands. The book gives short shrift to any problems the user might have in this area. If you can't get mysqli to work, you can't run any of the code in the second half of the book. I figured out how to create an ODBC to a mysql database in php using the ODBC commands instead, but I would like to be able to use mysqli.
Search Customer Reviews
Only search this product's reviews

Look for similar items by category