Chapter 2. Installation

Developers working with PHP and MySQL often find it more convenient to work on a local computer rather than a remote web server. In general, it is also safer to create and test your applications on a local—preferably private—computer and then deploy them to a public server where others can enjoy your work. Typically, you need to install Apache, PHP, and MySQL on the local computer, while your ISP handles installation on the public server.

Developing Locally

Developing your web applications on your local computer is a good way to learn, because you can interact with all of the components on your own machine and not risk causing problems on a production server. That way, if there are problems in the local environment, you can fix them immediately without exposing them to your site’s visitors. Working with local files means that you don’t have to FTP them to a server, you don’t have to be connected to the Internet, and you know exactly what’s installed, since you did it yourself.

There are three components to install:

  • Apache

  • PHP

  • MySQL

You need to install the programs in that order. All our examples will be from the installation perspective of a PC with Windows installed, with notes for Macintosh and Linux systems.

Tip

The easiest way to install Apache, PHP, and MySQL on most Linux systems is to download a packaged distribution. All popular Linux distributions have prebuilt packages from Apache, PHP, and MySQL. For example, Redhat Linux uses .rpm packages, while Debian ...

Get Learning PHP & MySQL, 2nd Edition 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.