Chapter 3. Getting Started with PHP

In this chapter, we'll give detailed directions for installing PHP and finish with a few tips on finding the right development tool. By the end of the chapter, you should be ready to write your first script.

Installing PHP

This section looks at the installation of PHP onto a computer. If you're going to be using a hosting provider that provides PHP or if you have a friendly sysadmin who has installed PHP for you, then this section will be of limited usefulness. PHP runs on various platforms, including Linux, various Unix flavors, Microsoft Windows, and Mac OS X. Linux is the most popular platform for PHP, and when combined with the Apache web server, and MySQL forms the acronym LAMP (although the "P" can also be Perl or Python).

If you plan to install PHP on Windows, you'll also need:

  • A working PHP-supported web server. Under previous versions of PHP, IIS/PWS was the easiest choice because a module version of PHP was available for it; but PHP now has added a much wider selection of modules for Windows. These days, Apache works very well with Windows, so we'll be focusing on PHP with Apache on Windows.

  • The PHP Windows binary distribution (download it at www.php.net/downloads.php)

  • A utility to unzip files (search http://download.cnet.com for PC file compression utilities), if your version of Windows doesn't include such a utility.

If you plan to install PHP on Linux, you may be able to take advantage of your distribution's ...

Get PHP6 and MySQL® 6 Bible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.