11 Aug, 2008 in LAMP, Linux by admin

Apache 2 and PHP Installation

I first used httpd-2.0.43 and -4.3.0 with RedHat 7.3. I am now using httpd-2.2.3 and -5.2.0 with SUSE 10.1.
Note: If you have problems with and think it’s a recent bug, you may want to consider using the latest http://snaps..net/ snapshot. Beware that snapshots frequently have regression and are not for production use. Usually problems are because of mis-configuration, not bugs, so snapshots will probably hurt more than help.

1. /unpack Apache2 source from the Apache httpd server website, http://httpd.apache.org/

2. In the Apache 2 source , create a Makefile by typing:
./configure –prefix=/usr/local/apache \
–enable-so \
–enable-cgi \
–enable-info \
–enable-rewrite \
–enable-speling \
–enable-usertrack \
–enable-deflate \
–enable-ssl \
–enable-mime-magic
You only need the enable-so line above. For information on other options, type ./configure –help and see “Compiling and Installing” in the Apache 2 Documentation, http://httpd.apache.org/

3. Make Apache from the just-created Makefile:
make

4. If make is successful, install Apache as root:
make install

5. /unpack source from the website, http://www..net/
Pick the latest from the 4.x series or 5.x series.

6. In the source , create a Makefile by typing:
./configure \
–with-apxs2=/usr/local/apache/bin/apxs \
–with-mysql \
–prefix=/usr/local/apache/ \
–with-config-file-path=/usr/local/apache/ \
–enable-force-cgi-redirect \
–disable-cgi \
–with-zlib \
–with-gettext \
–with-gdbm

You only need the –with-apxs2, and prefix lines. –with-mysql adds MySql, –with-config-file moves the .ini file location, disable-cgi disables the CGI version, which is not needed if you use Apache modules. It also enables and installs the command line interface (CLI) version. –with-zlib allows use of gzip-type compression, –with-gettext is for internationalization, and –with-gdbm allows access to GDBM databases. For more information, type ./configure –help and see the “Installation” chapter in the Manual, http://ww..net/docs.

7. Make from the just-created Makefile:
make

8. If make is successful, type this as root to install :
make install

If you are not root (I do not perform makes while root, for security and safety reasons), become root and type the following:
make install-su

9. If file /usr/local/apache/modules/libphp5.so does not exist or is an older version, type this (change this to libphp4.so for 4):
cp -p .libs/libphp5.so /usr/local/apache/modules

10. Install the .ini file:
cp -p .ini-recommended /usr/local/apache//.ini

11. Add these directives are in /usr/local/apache/conf/httpd.conf (if already there, verify they are correct):

# Make sure there’s only **1** line for each of these 2 directives:
# Use for 4.x:
#LoadModule php4_module modules/libphp4.so
#AddHandler -script

# Use for 5.x:
LoadModule php5_module modules/libphp5.so
AddHandler php5-script

# Add index. to your DirectoryIndex line:
DirectoryIndex index.html index.

AddType text/html

# Syntax Coloring
# (optional but useful for reading source for debugging):
AddType application/x-httpd--source phps

Bookmark This

No Responses so far | Have Your Say!

Leave a Feedback

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>