Apache and php installation

Affair requires affair, with php and mysql support. Here we assume mysql is already successfully installed, as it is a necessary component for DATE. The first step is to get the latest stable apache and php code in tar.gz format:

Apache
URL : http://httpd.apache.org/download.cgi
Current Version - 2.2.3

PHP
URL : http://www.php.net/downloads.php
Current Version - 5.x


Become root user and untar the files:

  • su
  • tar -zxf httpd-2.2.3.tar.gz (enter)
  • tar -zxf php-5.1.6.tar.gz (enter)

Apache installation:

Now on to apache installation:

  • cd httpd-2.2.3 (enter)
  • ./configure --prefix=/usr/local/apache2 --enable-mods-shared=most (enter)
  • make
  • make install

Apache will be installed at this point in the /usr/local/apache2 directory.

PHP installation:

  • cd php-5.1.6 (enter)
  • ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql (enter)
  • make
  • make install (enter)
  • cp php.ini-recommended /usr/local/php/lib/php.ini (enter)

Open this (/usr/local/php/lib/php.ini) file with your favorite editor and find the doc_root section and enter the correct path for the directory which serves your web content, such as:

  • doc_root= "/usr/local/apache2/htdocs/"
  • That is it as far as php is concerned.

    At this point several changes need to be made to the apache configuration file /usr/local/apache2/conf/httpd.conf. So, with your favorite editor, open this file and:

    • Check to make sure the following line is present in the file at the bottom of the LoadModule list, if it is not there add it
      • LoadModule php5_module modules/libphp5.so
    • Find the DirectoryIndex line and edit it so it looks like the following:
      • DirectoryIndex index.html index.html.var index.php
    • Find the AddType application section and add the following line:
      • AddType application/x-httpd-php .php
    • To enable the password protected offline analysis of the web interface, find the AllowOveride line within the section and change it from AllowOveride None to:
      • AllowOveride All
    • Now enable the affair mysql username and password to be available for the web interface by adding the following lines (Of course, use your real username and password):
      • <VirtualHost *:80>
      • php_value mysql.default_host localhost
      • php_value mysql.default_user my_username
      • php_value mysql.default_password my_password
      • </VirtualHost>

    That is it as far as apache with php with mysql support is concerned.

    The apache web server is started by

    • /usr/local/apache2/bin/apachectl start (enter)