Installing a new Apache with PHP


  • I was tasked with installing a new Apache and PHP on an existing and working RHEL4 servers. The new install had to be separate from the current one so to not disrupt the current work.

    Apache 2.2

    Apache was somewhat easy to install but here are my steps anyway.

    I downloaded the source code from apache.org and untarred in my home directory.

    As myself I then configured it with these parameters:

    ./configure –prefix=/opt/apache22 –exec-prefix=/opt/apache22 –datadir=/opt/apache22 –enable-mods-shared=all

    Built it as myself with:

    make

    and as root installed it with:

    make install

    I had to modify the /opt/apache22/conf/httpd.conf for a few things. After the ServerRoot line I added these 2 lines:

    PidFile “/opt/apache22/httpd.pid”
    LockFile “/opt/apache22/access.lock”

    These allow many version of Apache to run on the same server without stepping on each other files. There is more to it but these were the 2 lines that took me a while to figure out because I was not reading the comment in the configuration file properly.

    I also modified these lines to match what I wanted to do:

    Listen 8000
    User apache
    Group apache
    DocumentRoot “/var/www/html_php5″
    <Directory “/var/www/html_php5″>
    ScriptAlias /cgi-bin/ “/var/www/cgi-bin/”
    <Directory “/var/www/cgi-bin”>

    Listening on an other port is the option I took to make sure I could run 2 Apache without stepping on each other toes. The user and group are the ones in RHEL4/5 so I simply re-used. The document root is a directory I created to be different than the default one (/var/www/html) used in RHEL4/5.

    So it was quite simple for the Apache portion

    PHP 5.2

    Posted on

  • Leave a reply

    You must be logged in to post a comment.