Debianhelp.co.uk


Installing Apache 2 in Debian 3.1 (Sarge) with PHP5 support

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 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

http://youripaddress/apache2-default/

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.

Install PHP5 support for Apache2

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

or

deb http://people.debian.org/~dexter php5 sarge
deb-src http://people.debian.org/~dexter php5 sarge

Now you need to save your file and run the following command to take our new changes effect

#apt-get update

Now you need to install PHP5 required packages for apache

#apt-get install php5 libapache2-mod-php5 php5-curl php5-gd

that's it PHP5 for apache2 installed now you need to do the following

#cd /etc/apache2/mods-enabled/

#ln -s /etc/apache2/mods-available/php5.load

#ln -s /etc/apache2/mods-available/php5.conf

Now you need to restart your apache server using the following command

#/etc/init.d/apache2 restart

Now you apache server is ready with PHP5 support