[ Friday 3rd September 2010 ]
 
 


In under 10 minutes...

Back

  The Slackware Guide to installing AMP - Apache, MySQL, & PHP
This is my guide on how to get the latest versions of Apache, Mysql, and PHP 5 up and ready.
 
 
  The Procedure


Note: for a text editor, here i use pico. If you want a quick tutorial on it,

=====================
Using Pico, or Nano
=====================
to edit a file

code:
pico myfile

code:
pico /etc/apache2/myfile

to save
code:
ctrl + o
enter

to exit
code:
ctrl + x
enter

to save and exit (together)
code:
ctrl + o + x
enter



=====================
MySQL 4.1.11
=====================

download from linuxpackages.net
=============
code:


install
============
code:
installpkg mysql-4.1.11-i486-2mjg.tgz


create a group called mysql
============
code:
groupadd mysql


create user mysql (if you don't have him.. to see if you do, type su - mysql. If it says "Unknown id: mysql" then you don't have that user.
============
code:
useradd -g mysql mysql


give user mysql access
============
code:
chown -R mysql.mysql /var/lib/mysql


install a database from user mysql
============
code:
su - mysql
mysql_installdb
exit


create a my.cnf file
============
code:
cp /etc/my-medium.cnf /etc/my.cnf


keep the socket in /var/run/mysql/, its more secure than /tmp.
don't modify anything else

start mysql
============
code:
chmod +x /etc/rc.d/rc.mysqld
su - mysql
/etc/rc.d/rc.mysqld start
exit


set a password for mysql root user
============
code:
/usr/bin/mysqladmin -u root password 'new-password'



From this point onwards, i prefer to use mysqlcc to set mysql up..
download it from
http://dev.mysql.com/downloads/other/mysqlcc.html

unpack it
============
code:
tar xvfz mysqlcc-0.9.4-linux-glibc23tar.gz


run it
============
code:
cd mysqlcc-0.9.4-linux-glib23/
./mysqlcc


file > new
name: mylocalmysql
hostname: localhost
user: root
password: **********
socket file: /var/run/mysql/mysql.sock

click on test, it should be successful



=================================
APACHE 2.0.53
=================================

download apache
=============
code:


install apache
==============
code:
installpkg apache2-2.0.53-i486-2spi.tgz


edit apache config file
===============
code:
pico /etc/apache2/httpd.conf

You don't really have to edit anything right now. Apache should work with the current configs.


==================================
PHP 5.0.4
==================================

download php-apache2
==============
code:


install php-apache2
==============
code:
installpkg php-apache2-5.0.4-i486-1spi.tgz


download & install t1lib 5.0.2 (needed)
=================
code:
wget ftp://ftp.scarlet.be/pub/linuxpacka...2-i486-2spi.tgz

installpkg t1lib-5.0.2-i486-2spi.tgz



configure php
==============

edit httpd.conf and make sure this line is at the bottom of the file
=============
code:
pico /etc/apache2/httpd.conf

Include /etc/apache2/mod_php.conf


edit mod_php.conf
==================
make sure the line looks similar to this

code:
LoadModule php5_module lib/apache2/libphp5.so



start apache & php
==============
code:
apachectl start

or
code:
/etc/rc.d/rc.httpd start


When started, go to your web browser, and go to
code:
http://localhost

you should see a website. Good.

let's test php
===============
code:
cd /var/www/htdocs


create a file called test.php and add the following to it

[CODE/<? phpinfo(); ?>[/CODE]

You should now be able to see all the php configurations.
If you search for mysql, you won't find it.
Let us link mysql to apache and php now.

stop apache
===========
code:
apachectl stop

or
code:
/etc/rc.d/rc.httpd stop


go back to /etc/apache2, and edit php.ini
==================
code:
cd /etc/apache2/
pico php.ini


search for mysql
============
code:
ctrl + w  mysql


uncomment the line ;extension=mysql.so by removing the ';'
============
code:
extension=mysql.so


restart apache
============
code:
apachectl start


refresh the http://localhost/test.php
and search for mysql
now you will find it halfway through the webpage.

Congratulations... =)