PHP on Apache: The Definitive Installation Guide Page 4
In order to build
mod_php for static inclusion in the Apache
server it's necessary to jump back and forth between the Apache and PHP
directories, following a series of interdependent configuration and compilation
steps. You indicate that you're building
mod_php statically by
--with-apache switch on the
./php/php3/configure script invocation.
% # % # Preconfigure Apache so that PHP knows where things are % # % cd ./apache-1.3 % ./configure --prefix=/usr/local/web/apache % # % # Now configure and build PHP as a module % # % cd ../php/php3 % rm -f config.status config.cache % ./configure --with-apache=../../apache-1.3 other-switches % make % make install % # % # Now *really* configure Apache, and build it % # % cd ../../apache-1.3 % ./configure --prefix=/usr/local/web/apache \ > --activate-module=src/modules/php3/libphp3.a % make % # % # Install the resulting httpd application % # % /usr/local/web/apache/bin/apachectl stop % cp src/httpd /usr/local/web/apache/bin % cd ../php/php3 % cp php3.ini-dist /usr/local/lib/php3.ini % /usr/local/web/apache/bin/apachectl start
(You will probably have to execute the last five commands as
See how complicated this is? Repeat for every PHP module rebuild.
Building mod_php as a Dynamically Loaded Object
To build PHP as a dynamic Apache module, build and install the Apache server itself using the APACI method (i.e., with the
./apache-1.3/configurescript). This is because the PHP
configurescript needs to use one of the files that APACI installs.
To build PHP as a dynamic shared object (DSO), use the following sequence of commands:% cd ./php/php3/ % rm -f config.status config.cache % make clean % ./configure --with-apxs=/usr/local/web/apache/bin/apxs other-options % make % /usr/local/web/apache/bin/apachectl stop # shut down Apache entirely % make install % /usr/local/web/apache/bin/apachectl start # restart Apache
When that's all done, your Apache server should be capable of handling PHP CGI scripts and PHP-enabled Web pages. And to upgrade just PHP from a new version, just repeat the process--without touching any other part of Apache.
For building PHP on Red Hat Linux 6.1 and using the Apache RPMs, fix a broken file provided by them before executing the above commands. See the "Fixing Red Hat 6.1's apxs Script" appendix in this article for the details.
Testing Your Installation
If you built PHP as a script interpreter, verify that it is working correctly by creating and executing a test script such as the following:
IT Solutions Builder TOP IT RESOURCES TO MOVE YOUR BUSINESS FORWARD
Which topic are you interested in?
What is your company size?
What is your job title?
What is your job function?
Searching our resource database to find your matches...