Techware Labs Header

Forums have moved

See this announcement for more details, or just go directly there.

Go Back   Techwarelabs Community > Tech > Operating Systems

Thread Tools Display Modes
Old 09-21-2001, 02:11 PM
Posts: n/a
Default Linux Apache MySQL PHP (LAMP) Guide

[Linux Apache MySQL PHP (LAMP) Guide

Created on November 20th, 1999, by Wicked187

LAMP has become a defacto-standard around the web community in the recent years, here is a guide to help you set it up. LAMP is the combination of Linux + Apache + MySQL + PHP. You probably already have Linux up if you have come this far, if not you can get help setting it up throughout this site and on on DALnet.

Apache is the most popular web server on the net. It is very secure, fast, and reliable. There are may customizations you can make it, such as PHP support (which I am covering), CGI/Perl, SSL, SSI, ePerl, and even ASP. MySQL is the fastest RDBMS in the world. It is very good for web based applications as well. Many tools have been developed for MySQL with PHP, such as phpMyAdmin, a very good web based admin tool for MySQL, which can do anything your heart desires with MySQL.

PHP is an up and coming server-side scripting langauge. It was developed by Rasmus Lerdorf, and countless others. It is currently in version 3.0.12. It has many advantages over its competitors (ASP, Cold Fusion, Perl, Java, ...) , such as it is Object Oriented, embedded into HTML, very fast, cross-platform compatible, can run as an Apache Module, it is constantly updated and fixed, and it borrows the best features from many other langauges. Now that I have filled you with my propaganda, let's get started.

First of all, download the latest stable sources of Apache, MySQL, and PHP, you can find them at,, and, respectively. I would move them into /usr/local/src for consistancy, as well as making sure you get the tarball versions. Next, unpack them by typing:

tar -zxvf filename.tar.gz

Now, we are going to setup MySQL first cd into the mysql directory, maybe /usr/locl/src/mysql-3.23.41 Then configure it by typing:

./configure --prefix=/usr/local/mysql

This will put it in it's own directory, which I always put things in /usr/local as a standardization. Run the make command:


Run the make install command:

make install

Now it is installed. You need now to set it up. Add the MySQL Libraries to the ldconfig file:

echo "/usr/local/mysql/lib/mysql" >> /etc/

Now have it cache all of the libraries:

ldconfig -v | grep libmysqlclient

You should now see something returned like: =>

Now have MySQL start at boot time:

echo "/usr/local/mysql/bin/safe_mysqld --skip-networking >> /dev/null &" >> /etc/rc.d/rc.local

Now you must make the initial databases the MySQL needs to run:


Now start up the service daemon for MySQL:

/usr/local/mysql/bin/safe_mysqld --skip-networking >> /dev/null &

Now add it to the path:


Now you should test MySQL:

mysqladmin version

This should give you back all kinds of info on MySQL. Now create a password for the SuperUser:

mysql -u root -p

It will then prompt your for a password:

Enter password:

And MySQL should be setup.

Now the next part is making the new Apache/PHP setup. If you are currently using Apache and have stuff that you would like to keep, do a backup on your data. Now blow away the old Apache, delete it by any means possible. Now change into the Apache source directory:

cd /usr/local/src/apache_X.X.X

Configure apache:

./configure --prefix=/usr/local/apache

Now change into the PHP source directory:

cd /usr/local/src/php-X.X.XX

And run the configuration of php to support MySQL and Apache:

./configure --with-apache=../apache_X.X.X --with-mysql=/usr/local/mysql

Now run the make command:


Now run the make install command:

make install

Now change back into the apache source directory:

cd ../apache_X.X.X

Now you have to reconfigure Apache, because we have added in the PHP Module. This will have it use the module you provided:

./configure --prefix=/usr/local/apache --activate-module=src/modules/php3/libphp3.a

This will configure it. Now you must run the the make and make install commands:


make install

There is a possibility that it will complain about not having an ANSII C compiler. If so, goto the FAQ on the site. There are some common fixes there. If everything went well, you now have a few last minute setup processses to go through. Rename the http daemon:

mv /usr/local/apache/bin/httpd-X.X.X /usr/loacl/apache/bin/httpd

Now make a sybolic link and startup the http daemon:

ln -s /usr/local/apache/bin/httpd /usr/sbin/httpd


Now that it is up, test and see the version information:

httpd -v

Now you have to add a couple of pieces of info to the apache configuration files. They are located i /usr/local/apache/conf/

pico httpd.conf

Find the AddType section and uncomment these lines:

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

This will make apache understand that it needs to pass these extensioned file to the php3 engine. Now find the DirectoryIndex section and add some info for php. It should look like this:

DirectoryIndex index.html index.phtml index.php index.phps

That should do it. Now restart the Apache http daemon:

killall -HUP httpd

Apache should be up with support for php. You can now add the phpMyAdmin tool that is found at or anyting else you would like
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT -5. The time now is 06:25 AM. Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Forum style by ForumMonkeys.