April 26, 2019

Adding PHP to Apache on Linux - page 5

Supercharging Your Web Pages

  • December 23, 1999
  • By Ken Coar

Like Perl, PHP can be used in standalone scripts as well as embedded in Web pages. Unfortunately, to do both you will need to build it twice: once for each type of use. (Version 4 of PHP supposedly allows a single build to provide both the standalone script engine and the Apache module.)

Building the PHP script interpreter is very simple:

    % cd ./php/php3/
    % rm -f config.status config.cache
    % make clean
    % ./configure --enable-discard-path other-options
    % make
    % make install

(Performing the make�install step requires write access to the /usr/local/bin directory, so you may need to execute it as root.)

The --enable-discard-path switch on the ./configure invocation is necessary to use PHP scripts as CGI scripts under a Web server, such as in the cgi-bin directory. To just invoke PHP scripts directly from shell command lines, you can omit it. Of course, it does no harm to include it, so you might as well.

Most Popular LinuxPlanet Stories