Every Flavour Beans

“The time has come…to talk of many [technologies].” –Lewis Carroll(’The Walrus and the Carpenter’)
Development Tools. Web Frameworks. GNU/Linux. Nokia N800. Video Encoding.

April 18, 2006

Apache + PHP + MySQL on Gentoo

Filed under: GNU/Linux, Gentoo, Web — tabrez @ 12:47 pm

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:

sh# emacs -nw /etc/make.conf

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

emerge the apache package:

sh# emerge apache
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:

sh# 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"

sh# /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:
  1. <?php
  2.     phpinfo();
  3. ?>

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

sh# emerge mysql mysql-administrator mysql-query-browser
sh# emerge –config mysql-4.1.14
sh# /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.


If you want to receive future posts by email, enter your email address here:

Related Posts:

  • Two Applications For Easy Management Of ‘USE’ Flags In Gentoo
  • Installing Complete LAMP Stack on Ubuntu 6.10(Edgy Eft)
  • How to Speed up Booting Into GNOME - A Gentoo Wiki Tip
  • Linux Bible 2007 Edition: Install/Run 10+ GNU/Linux Distributions(Ubuntu, Fedora, Gentoo etc)
  • Setting Up Rails Development Environment on Windows Vista/XP
  • How I Upgraded to Wordpress 2.3 on Live Blog With Zero Downtime
  • Java 1.5 and Eclipse in Gentoo - Part II

  • Readers who viewed this page, also viewed:


    2 Comments »

    1. hello there,
      i am trying to reproduce a data server that a company uses to present information to its customers via the web. No problem. What they are using right now is Microsoft Access, connecting via ODBC to a server on line. The cool thing that they can do is have several tables linked together. Like if a certain field is updated in one table, it updates the same info automatically in another table. So, i want to reproduce this in MySQL, but i can't seem to find out how. Is there a way to pull this off on the server side ? or does that have to be done on the client side ?
      thanks for any tips.

      Quote

      Comment by jeff — September 19, 2006 @ 8:02 pm

    2. I don't understand your question completely, but what you are asking just needs establishing relationships among multiple talbes using primary-foreign key mappings I think. A quick googling resulted in these links:
      Relationships in MySQL
      MySQL and MS Access

      Quote

      Comment by tabrez — September 21, 2006 @ 10:33 am

    RSS feed for comments on this post. TrackBack URI

    Leave a comment

    Subscribe without commenting


    Copyright (c) 2006, 2007 Tabrez Iqbal.
    Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. Verbatim copying and distribution of this entire article is permitted in any medium without royalty provided this notice is preserved. A copy of the license is included in the section entitled "GNU Free Documentation License".


    Powered by WordPress
    This website is hosted by Dreamhost