Apache, MySQL, PHP Installation
Linux Apache MySQL PHP (LAMP) Guide
by Wicked187, email@example.com
Created on November 20th, 1999
Last modified on 29 November 2001 by KrnlPanic, firstname.lastname@example.org.
This tutorial will explain how to install the Apache webserver, first and foremost, but also includes the steps to installing mod_php, mod_perl and MySQL. 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
First of all, download the latest stable sources of Apache, MySQL, and PHP, you can find them at www.apache.org, www.mysql.com, and www.php.net, respectively.
I would move them into /usr/local/src for consistency, as well as making sure you get the tarball versions. Next, unpack them by typing:
tar -zxvf filename.tar.gz
(skip this if just building Apache)
Now, we are going to setup MySQL first cd into the mysql directory, maybe /usr/local/src/mysql-3.22.27. Then configure it by typing:
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:
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/ld.so.conf
Now have it cache all of the libraries:
ldconfig -v | grep libmysqlclient
You should now see something returned like:
libmysqlclient.so.6 => libmysqlclient.so.6.0.0
Now have MySQL start at boot time:
echo “/usr/local/mysql/bin/safe_mysqld > /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 > /dev/null &
Now add it to the path:
Now you should test MySQL:
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:
And MySQL should be setup.
(configure so PHP and/or perl can built)
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 (specifically httpd.conf or vhost.conf).
Now change into the PHP source directory:
And run the configuration of php to support MySQL and Apache:
./configure –with-apache=../apache_1.3.X –with-mysql=/usr/local/mysql
Now run the make command to compile php4:
Now run the make install command:
As you go through the mod_perl www.ourhealthissues.com/product-category/smoking-cessation/ install, you may come across some missing dependencies. If you have CPAN installed on your system, you can install the failed dependencies using the CPAN shell. You will need the following in order to install mod_perl.
To install them, you can enter the CPAN shell with the following command:
perl -MCPAN -e shell
Now use the install command in CPAN like this:
If dependencies were not met on the first run of perl Makefile.PL, you will need to re-run it prior to moving on to the next step.
Once you are satisfied with the configuration of mod_perl, go ahead and build it with:
And install it with:
Installation of mod_perl is now complete.
Back to Apache
Now change back into the apache source directory:
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/php/libphp.a
This will configure it. Now you must run the the make and make install commands:
There is a possibility that it will complain about not having an ANSII C compiler. If so, goto the FAQ on the www.php.net 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-1.3.X /usr/local/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:
Now you have to add a couple of pieces of info to the apache configuration files. They are located iusr/local/apache/conf/
Find the AddType section and uncomment the following 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 php 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 www.phpwizard.net or anyting else you would like.
If you need help, let us know and we’ll be happy to do what we can. Hell, I might even build it for ya 😉