Apache + PHP + MySQL on Gentoo
Most of the today's web applications need the combo of Apache, PHP and MySQL packages to be first installed on the system. Installing these software on a Gentoo system should be a straightforward process. Below is the complete procedure.
First add apache2 and mysql to the USE flag in the /etc/make.conf file:
USE="gtk gnome qt kde dvd alsa cdr hal howl imap maildir mysql apache2"
emerge the apache package:
sh# /etc/init.d/apache2 start
sh# rc-update add apache2 default
Test the installation by accessing the url http://localhost/ from a web browser. If you get a welcome message from apache, the installation is complete. More info here.
Now emerge PHP4 and the mod_php module for apache:
Add the configuration directive(-D PHP4) to /etc/conf.d/apache2 file and restart the apache web server:
APACHE2_OPTS="-D DEFAULT_HOST -D PHP4"
Create a sample php script in the directory /var/www/localhost/htdocs with the following contents and access it from the web browser to test the php installation:
[php]