By Default apache2 package you will be given the package apache2-mpm-worker, other packages are available: apache2-mpm-worker
The worker MPM provides a threaded implementation for Apache2. It is considerably faster than the traditional model, and is the recommended MPM. apache2-mpm-prefork
This Multi-Processing Module (MPM) implements a non-threaded, pre-forking web server
that handles requests in a manner similar to Apache 1.3. It is appropriate for sites that need to avoid threading for compatibility with non-thread-safe libraries.
#apt-get instal install apache2
#apt-get install apache2-mpm-prefork
That's it basic apache2 installation finished.If you want to test your installation go to your browser and type the following
This should display welcome message then your installation is correct.
Default document root directory for apache2 is /var/www
If you want to change the default document root directory in apache2 you have to modify /etc/apache2/sites-available/default file.Edit this file and change the path to where ever you want to change. Now you need to install PHP4 and PHP5 modules for apache2
If you want to run PHP5 and PHP4 supprt at the same time it is not possible, we must run one of them as CGI, the other one as Apache module. We will use PHP5 as Apache module and PHP4 as CGI.
If you want to install PHP5 from debian packages you need to enter the one of the source list in your /etc/apt/sources.list file deb http://packages.dotdeb.org stable all
deb-src http://packages.dotdeb.org stable all
Now you need to run the following command to update source list
Now you need to install following modules to support PHP5 and PHP4
#apt-get install libapache2-mod-php5 php4-cgi php5-curl php5-dev php5-gd php5-gmp php5-imap php5-ldap php5-mcrypt php5-mhash php5-ming php5-mysql php5-mysqli php5-odbc php5-pdo-mysql php5-pdo-sqlite php5-pear php5-pspell php5-snmp php5-sybase
php5-tidy php4-curl php4-domxml php4-gd php4-gmp php4-imap php4-ldap php4-mcal php4-mcrypt php4-mhash php4-ming php4-mysql php4-odbc php4-pspell php4-recode php4-snmp php4-xslt
php4-xdebug curl libwww-perl imagemagick
Now you need to change the following line from /etc/apache2/apache2.conf file
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml
DirectoryIndex index.html index.htm index.shtml index.cgi index.pl index.php index.php4 index.xhtml
and add these two lines in the section where you can find AddType and AddHandler directives
AddHandler php-script .php4
Action php-script /cgi-bin/php4
This will make sure that PHP files with the extension .php4 are executed as CGI. PHP files with the extension .php will be run by the Apache2-PHP5 module.
Next, we have to enable a few Apache modules, like for example the actions module otherwise we cannot run PHP4 as CGI
#a2enmod actions ssl rewrite suexec include
Now you need to restart your apache server using the following command:#/etc/init.d/apache2 restart http://www.debianhelp.co.uk