Steve & Kathy's Website

Installation of Debian 3.1 (Sarge), Apache2, PHP and MySQL (December 2005)

The following comments are based on the installation of Debian 3.1 (Sarge), Apache2, PHP and MySQL on a Dell Dimension computer that had a MS Windows 98 installation. The computer has a 700 MHz Pentium III processor, 128MB SDRAM and a 30GB hard drive. The computer is attached to a home network using a 3COM Ethernet 10/100 NIC. The initial installation was from a single CD provided with the book, Debian GNU/Linux 3.1 Bible. Please note that I am completely new to Linux. This is the first and only book I have on the subject. My plan was to configure the new installation as an internet server (web design being a hobby of mine).

The only pre-installation change I needed to make was to enter the BIOS and move the CD drive ahead of the hard drive in the boot order, as directed by the book.

The initial installation went very smoothly. There were no problems with hardware detection. Because I was not interested in keeping the MS Windows OS, I used the whole drive for partitioning for Linux. I allotted 256MB to a swap partition and the remainder to root. The partitioning was simple--the installation guides you through it.

I spent some time navigating the file system to learn where things were (using the cd and ls commands), then used aptitude to install Apache2, PHP4 and MySQL. It was great to have the program tell me what other programs or modules were needed and download and install them automatically.

Apache2 worked right off the bat. I was able to point the web browser on my laptop (via my wireless network) at the default index page on the first attempt. I then installed PuTTY, a free telnet/SSH client, on my laptop to allow remote control of the Debian server.

MySQL seemed to be working, although the only testing I had done at this point was to access it, set a password for root and create another user.

My first real challenge was to find the web root, which I finally located in /var/www. Using touch and nano, I created a PHP test page and placed it in /var/www. I pointed my browser at it--nothing! Now the real challenge began.

According to the book, I needed to ascertain that the apache2.conf file had the following lines un-commented:

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

They hadn't been, so I un-commented them. Then, the book recommended making certain the line

LoadModule php4_module /usr/lib/apache/1.3/libphp4.so

was also uncommented. Well, there was no such line (or a similar one using apache2 instead of apache/1.3). I started looking around and could find no evidence of a php4 module in /usr/lib/apache2. Then I went back and examined the installed files using aptitude. I discovered that the required module (libapache2-mod-php4) hadn't been downloaded. Reading the descriptions in aptitude carefully, I also discovered why. Apparently Apache2 can be downloaded as apache2-mpm-prefork or apache2-mpm-worker, and I had the worker version. Only the prefork version supports PHP4. So I downloaded the PHP4 module. aptitude took care of removing the apache2-mpm-worker and installed apache2-mpm-prefork.

Examining the apache2.conf file, there still wasn't a LoadModule line for libphp4. There was, however, a line at the end of the file directing Apache to include the mods-enabled file. Looking there, I discovered the newly added php4.conf and php4.load files. Eureka!

Testing it with the phpinfo.php file I placed in the webroot, IT WORKED!