Apache2, PHP 4.0 and MYSQL on Gentoo Install Guide

Last updated: 12/13/2004

Introduction:

This is my howto on installing a typical LAMP on my favourite distro, Gentoo. For this guide I used Gentoo 2004.3 on my dual P3 550 with 1GB of ram and 3 9GB SCSI drives. Other than a computer with a working internet connection and a completed installation of Gentoo, there's nothing further you'll need.

How to use this guide:

Commands are in bold, notes are not. Links will take you to my config files or examples of them. // indictates my comments, not something for you to type. Let's start!

1. Installing Apache, php and MYSQL
emerge apache
emerge php mod_php
emerge mysql

 

2a. Configuring Apache
vim /etc/conf.d/apache
APACHE_OPTS="-D PHP4" //uncomment this line and modify it

vim /etc/apache2/conf/apache2.conf

[code from apache2.conf]
ServerName 127.0.0.1 //change the ip to your domain name

#parse php in html
#add this line to the bottom of the conf file
AddType application/x-httpd-php .php .html .htm

#for directory views, directory access and vhosts see the example above.
[/code]

/etc/init.d/apache2 start //start apache2
rc-update add apache2 default //start apache2 on boot

 

2b. Configuring MYSQL
/etc/init.d/mysql start
you will get a specific error message telling you to run a mysqladmin command. do it.
rc-update add mysql default

php 4.0 has no configuration requirements.

 

3. Testing your LAMP setup
browse to http://localhost/ and you'll see apache's test page
the default webroot is /var/www/localhost/htdocs

installation is complete.