Hour 2: Installing PHP
|
Overview
|
Before getting started with the PHP language, you must first acquire, install, and
|
configure the PHP interpreter. PHP is available for a wide range of platforms and
|
works in conjunction with many servers.
|
In this hour, you will learn
|
Which platforms, servers, and databases are supported by PHP4
|
Where to find PHP and other useful open source software
|
One way of installing PHP on Linux
|
Some options that add features to your PHP binary
|
Some configuration directives
|
How to find help when things go wrong
|
Platforms, Servers, Databases, and PHP
|
PHP is truly cross-platform. It runs on the Windows operating system, most versions
|
of UNIX including Linux, and even the Macintosh. Support is provided for a range of
|
Web servers including Apache (itself open source and cross-platform), Microsoft
|
Internet Information Server, WebSite Pro, the iPlanet Web Server, and Microsoft's
|
Personal Web Server. The latter is useful if you want to test your scripts offline on a
|
Windows machine, although Apache can also be run on Windows.
|
You can also compile PHP as a standalone application. You can then call it from the
|
command line. In this book, we will concentrate on building Web applications, but
|
do not underestimate the power of PHP4 as a general scripting tool comparable to
|
Perl.
|
PHP is designed to integrate easily with databases. This feature is one of the factors
|
that make the language such a good choice for building sophisticated Web
|
applications. Many databases are directly supported, including Adabas D, InterBase,
|
Solid, dBASE, mSQL, Sybase, Empress, MySQL, Velocis, FilePro, Oracle, UNIX dbm,
|
Informix, and PostgreSQL. PHP also supports ODBC.
|
30
|
Throughout this b ook, we will be using a combination of Linux, Apache, and MySQL.
|
All these are free to download and use, and can be installed relatively easily on a PC.
|
You can find out more about getting Linux for your computer at
|
<http://www.linux.org/help/beginner/distributions.html >. If you want to run Linux
|
on a Power PC, you can find information about LinuxPPC at
|
<http://www.linuxppc.org>.
|
MySQL, the database we will use in this book, can be downloaded from
|
<http://www.mysql.com>. There are versions for many operating systems
|
including UNIX, Windows, and OS/2.
|
On the other hand, you can easily stick with Windows, NT, or MacOS. PHP is, after
|
all, a cross-platform scripting language.
|
Where to Find PHP and More
|
You can find PHP4 at <http://www.php.net/>. PHP4 is open source software, which
|
means that you won't need your credit card handy when you download it.
|
The PHP WebSite is an excellent resource for PHP coders. The entire manual can be
|
read online at <http://www.php.net/manual/>, complete with helpful annotations
|
from other PHP coders. You can also download the manual in several formats.
|
Installing PHP4 for Linux and Apache
|
In this section, we will look at one way of installing PHP4 with Apache on Linux. The
|
process is more or less the same for any UNIX operating system. You might be able
|
to find prebuilt versions of PHP for your system, which are simple to install.
|
Compiling PHP, though, gives you greater control over the features built in to your
|
binary.
|
Before you install you should make sure that you are logged into your system as the
|
root user. If you are not allowed access to your system's root account, you may
|
need to ask your system administrator to install PHP for you.
|
There are two ways of compiling an Apache PHP module. You can either recompile
|
Apache, statically linking PHP into it, or you can compile PHP as a Dynamic Shared
|
Object (DSO). If your version of Apache was compiled with DSO support, it will be
|
capable of supporting new modules without the need for recompiling the server.
|
0 comments:
Post a Comment