|
Appendix A
Installing PHP
I
n this Appendix, I describe how to install PHP on the Unix/Linux, Windows,
and Mac platforms, both for use with Web sites and with PHP command
line interface (CLI). For Web sites, although PHP runs with several Web servers,
I discuss Apache and IIS (Microsoft Internet Information Server), which
together power almost 90 percent of the Web sites on the Internet. If you need
instructions for other operating systems or Web servers, see the PHP Web
site (
www.php.net
).
This appendix provides installation instructions for PHP 5. If you are installing
an earlier version, the installation may be slightly different; in this case, please
read the file
install.txt
that is provided with the PHP distribution.
Installing PHP on Computers
Running Unix/Linux
You can install PHP as a partner with Apache for use in Web pages or as a
stand-alone interpreter. If you want to use PHP for both Web sites and as
a stand-alone language, you need to install PHP with Apache and PHP CLI,
which are two separate types of PHP. The instructions below include informa-
tion for both types of PHP installations — PHP for the Web and PHP CLI.
You install PHP by downloading the source files, compiling them, and then
installing the compiled programs. This process isn’t as technical and daunting
as it may appear. I provide step-by-step instructions in the next few sections.
Read all the way through the steps before you begin the installation procedure
to be sure that you understand it all clearly. Try to have everything prepared
so you don’t have to stop in the middle of the installation.
For Linux usersonly:Many Linux distributions automatically install both
Apache and PHP, thus saving you the trouble of installing them yourself. In
addition, PHP for Linux is available in an RPM as well as in source files. It may
be in RPM format on your distribution CD. However, when PHP is preinstalled
or when you install it from an RPM, you can’t control the options that PHP
is installed with. For example, in these instances, PHP CLI may not have been
|