Page 50 - Beginning PHP 5.3
P. 50
Part I: Getting Up and Running with PHP
Installing PHP
To create and run PHP scripts, you need to have a few things in place:
❑ A computer running Web server software, such as Apache or Internet Information Server (IIS)
❑ The PHP server module installed on the same computer. This module talks to the Web server
software; this is the PHP engine that actually does the work of running your PHP scripts
❑ If you want to build database - driven Web applications — and you probably will — you also
need a database server installed. Options include MySQL, PostgreSQL, and SQL Server. This
book mostly refers to using MySQL, so that ’ s the database server that you ’ ll install here
Many combinations of operating system and Web server software (not to mention versions of PHP) are
available. For example, operating systems that can run PHP include Linux, Windows, and Mac OS X,
and Web server software includes Apache, IIS, and Zeus. To keep things simple, this chapter
concentrates on installing PHP and Apache on Ubuntu Linux, Microsoft Windows, and Mac OS X.
Installing on Ubuntu Linux
Linux is a popular choice among PHP Web developers, because both technologies are open source.
Furthermore, PHP tends to work well with Linux, Apache, and the MySQL database server; in fact, the
acronym LAMP (Linux, Apache, MySQL, and PHP) is often used to refer to this winning software
combo.
Ubuntu ( www.ubuntu.com ) is a popular Linux distribution that is easy to install. You can download it
from www.ubuntu.com/getubuntu/download ; the Desktop Edition is fine for developing PHP
applications. It comes in the form of a CD image, so you can just burn a CD from it, then pop your CD in
your computer’s drive and reboot to install it.
The Ubuntu Desktop Edition comes with a graphical package manager called Synaptic that you can use
to easily install the Apache Web server as well as the PHP module and the MySQL server. To do this,
follow these steps:
1. Run Synaptic by choosing System Administration Synaptic Package Manager. (You ’ ll prob-
ably be prompted to enter your root (admin) password that you created when you installed
Ubuntu.)
2. Click the Reload button in Synaptic ’ s toolbar to make sure it knows about the latest Ubuntu
packages.
3. Click the World Wide Web option in the list of package groups on the left side of the window,
shown in Figure 2-1 . Then, in the top - right window, click the checkboxes next to the following
packages: apache2, php5, php5 - curl, php5 - gd, php5 - mysql, php5 - sqlite, php5 - xsl,
and php - pear. You ’ ll see a pop - up menu appear each time you click a checkbox; choose Mark for
Installation from this menu, as shown in Figure 2-1 . Now click the Miscellaneous - Text Based
option in the package groups list on the left, then click the checkboxes next to mysql - client and
mysql - server.
12
9/21/09 8:50:18 AM
c02.indd 12
c02.indd 12 9/21/09 8:50:18 AM