Archive for web

Apache + PHP + MySQL on Gentoo

This blog is moved to the new location: beans.seartipy.com

You can read the same article at its new location: 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:

$ emacs -nw /etc/make.conf

USE=”gtk gnome qt kde dvd alsa cdr hal howl imap maildir mysql apache2

emerge the apache package:

$ emerge apache
$ /etc/init.d/apache2 start
$ 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:

$ emerge dev-php/php mod_php

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

$ /etc/init.d/apache2 restart

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
phpinfo();
?>

If you see a lot of information displayed about the version of PHP and other related things then PHP is installed and properly configured with the apache web server. Installation of PHP5 is also similar but be warned that still a lot of software runs only on PHP4(Eg: phpBB Bulletin Software). With a little bit of effort you can also run both PHP4 and PHP5 on the same system side by side.

Install MySQL and all the related tools:

Add the following lines to the /etc/portage/package.keywords file:

>=dev-db/mysql-administrator-1.1.5 ~x86
>=dev-db/mysql-query-browser-1.1.17 ~x86
>=dev-cpp/gtkmm-2.8 ~x86
>=dev-cpp glibmm-2.7 ~x86

$ emerge mysql mysql-administrator mysql-query-browser
$ emerge –config mysql-4.1.14
$ /etc/init.d/mysql start

Set a root password for mysql server when prompted by the ’emerge –config’ command. You can administer the mysql server by using either the command line tools or using the graphical tool mysql-adminstrator. Similarly, the command line client mysql can be used to create and view the database schemas or the graphical tool mysql-query-browser can be used. I recommed you give these two graphical applications a try.

Other databases, like PostgreSQL, can be used instead of MySQL whenever the applications support it, but a majority of the applications support only the MySQL database. WordPress for example doesn’t support PostgreSQL.


				

Comments (7)