ApacheApache

  Main Menu

Home: Linux: Apache: Compile_php_module
PHP Apache Home:

So you have apache built and installed, starting at boot and everything is hunky-dory peachy keen. So, you go to install php from rpm and it doesn't work. doh. So, time to set about building php. What I did was get a configure line from a redhat rpm build of php, read it from phpinfo(), then copy that into a file that I could edit and paste into a terminal window to build my own php.

Here is my configure line:
./configure \
--with-layout=GNU \
--with-config-file-path=/etc \
--program-prefix=/usr/local/apache \
--localstatedir=/var \
--sharedstatedir=/usr/com \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--prefix=/usr \
--with-config-file-path=/etc \
--enable-force-cgi-redirect \
--disable-debug \
--enable-pic \
--disable-rpath \
--enable-inline-optimization \
--with-db3 \
--with-curl \
--with-dom=/usr \
--with-exec-dir=/usr/bin \
--with-freetype-dir=/usr \
--with-png-dir=/usr \
--with-gd \
--enable-gd-native-ttf \
--with-ttf \
--with-gdbm \
--with-gettext \
--with-ncurses \
--with-gmp \
--with-iconv \
--with-jpeg-dir=/usr \
--with-openssl \
--with-png \
--with-regex=system \
--with-xml \
--with-expat-dir=/usr \
--with-zlib \
--enable-bcmath \
--enable-exif \
--enable-ftp \
--enable-magic-quotes \
--enable-safe-mode \
--enable-sockets \
--enable-sysvsem \
--enable-sysvshm \
--enable-discard-path \
--enable-track-vars \
--enable-trans-sid \
--enable-yp \
--enable-wddx \
--with-pear=/usr/share/pear \
--with-mysql=shared,/usr \
--enable-ucd-snmp-hack \
--enable-memory-limit \
--enable-bcmath \
--enable-calendar \
--enable-dbx \
--with-ming \
--with-apxs2=/usr/local/apache/bin/apxs


(Yes, the backslashes go in there. They let you escape the return which would normally start configure doing its configuring.)

The one thing that I added in was ming, a library for writing swfs (Shockwave Flash files). That requires installing ming, but it's really easy, just ./configure; make; make install.


Now, should just be able to do make; make install and edit your /usr/local/apache/conf/httpd.conf. Add these lines to your httpd.conf:
Search for AddType, then below the last AddType that Apache has (AddType image/x-icon .ico), add:
AddType application/x-httpd-php .php


Then, search for LoadModule, and after the last LoadModule (there were no real ones, just a foo.so example) add:
LoadModule php4_module modules/libphp4.so

Search for DirectoryIndexes and add index.php, so you get a line that looks like:
DirectoryIndex index.html index.html.var index.php

 

Thus spake the master programmer:

``When the program is being tested, it is too late to make design changes.''