A
Preparing Your Working
Environment
In order to avoid any headaches while going through the case studies in this book, it's best to
install the necessary software and configure your environment the right way from the start.
Although we assume you already have some experience developing PHP applications, we'll
quickly go through the steps to install your machine with the necessary software.
The good news is that all the required software is free, powerful, and (finally!) comes with
installers that make the programs easy for anyone to set up and configure. The bad news is that
there are many possible configurations, so the instructions written might not apply 100% to you
(for example, if you are using Windows, you may prefer to use IIS instead of Apache, and so on).
We'll cover the installation instructions separately for Windows and *nix based machines. We'll also
cover preparing the database that is used in many examples throughout the book; these instructions
apply to both Windows and *nix users, so be sure not to miss this section at the end of the appendix.
To build websites with AJAX and PHP you will need (quite unsurprisingly) to install PHP. The
preferred version is PHP 5, because we use some of its features in Chapter 11. You also need a
web server. We will cover installing Apache, which is the web server preferred by most PHP
developers and web hosting companies. Because we've tried to make the examples in this book as
relevant as possible for real-world scenarios, many of them need a database. We cover installing
MySQL, which is the most popular database server in the PHP world. Because we used simple
SQL code, you can easily use another database server without major code changes, or older
versions of MySQL.
At the end of this chapter, we'll cover installing phpMyAdmin, which is a very useful web tool
for administering your databases. You'll then learn how to use this tool to create a new database,
and then a database user with full privileges to this database.
In the following pages, you'll learn how to:
• Install Apache 2, PHP 5, and MySQL 5 on your Windows machine
• Install Apache 2, PHP 5, and MySQL 5 on your *nix machine
• Install phpMyAdmin
• Create a new database and then a database user using phpMyAdmin