February 22, 2019

Adding PHP to Apache on Linux - page 3

Supercharging Your Web Pages

  • December 23, 1999
  • By Ken Coar

PHP is open-source software, which means (among other things) that there are source code as well as binary versions available. As with a lot of open-source software, development on PHP is rapid enough that any attempt to put it on a CD or otherwise package it on a long-term distribution medium suffers from the 'instantly stale' syndrome.

In other words, the place to get the PHP software is the Internet itself. There are multiple Web sites devoted to the PHP project, but the main one is http://www.php.net/, and most of the others are reachable from there.

There are two ways of keeping up with the PHP project as its development continues:

  • Periodically download a tarball of a packaged release, or
  • Keep up with the very latest developments by keeping a synchronised copy of the master sources

In order to use PHP, you're going to need to build it, which means being familiar with the usual software development tools: a shell, tar, compiling, make, and so on.

The currently stable version of PHP is version 3. Its successor, version 4, is currently under development and there have been a few beta releases already. However, the version used in this column is the more wide-spread V3, and the instructions are specific to that version; they may or may not work with V4.

Getting the Most Recent Release

If you're afraid of warts and glitches that might lurk in the latest development version, updating only when a stable release is made is probably best. Of course, there are disadvantages inherent in playing it safe�such as not getting the latest bug fixes or feature additions, or the added pain of having to build the new version in a separate directory tree and then switch over from the old one to the new.

The easiest way to download a release tarball to your Linux system is to use a Web browser running on that system and visit http://www.php.net/downloads.php3, choose the appropriate package and save it. (It's not readily available in any other way; for instance, it's not accessible from the PHP site using FTP.)

Keeping Up with the Bleeding Edge

To really keep up with the very latest bug fixes (and bugs) in the latest development version, you'll need to have access to the Internet, a CVS client, and some development tools like autoconf, automake, and bison. Just download the latest revision of all of the sources (the latest version is called the "HEAD") into your working directory, and then build it as though it was extracted it from a release tarball. The following shows how:

    % cvs -d :pserver:cvsread@cvs.php.net:/repository login
    (Logging in to cvsread@cvs.php.net)
    CVS password:   use "phpfi" as the password
    % cd ./php
    % cvs -d :pserver:cvsread@cvs.php.net:/repository checkout php3

This will extract the latest versions of everything into the tree starting at ./php/php3/. The command will display lots of information about what it's doing, which can be ignored (except for error messages, of course!). In order to keep in sync with the latest changes being made to the master repository, just repeat the last two commands every few days.

Since this method involves grabbing the sources themselves rather than a prepared package, take at least this one extra step before you build: run autoconf in order to generate the ./php/php3/configure script. This is simple:

    % cd ./php/php3/
    % ./buildconf
    % autoconf

and you're ready to build.

To follow this path, subscribe to the php-dev mailing list to keep up to date with changes (like the addition of the buildconf step above, which is quite recent�and necessary; PHP won't build without it!). Find out more about the PHP mailing lists at http://www.php.net/support.php3.

Most Popular LinuxPlanet Stories