LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-09-2005, 04:18 AM   #1
xushi
Senior Member
 
Registered: Jun 2003
Location: UK
Distribution: Gentoo
Posts: 1,288

Rep: Reputation: 45
Slackware guide for AMP Apache MySQL & PHP


03-07-05 EDIT: Fixed typo 'mysql_install_db.

This is my guide on how to get the latest versions Apache, Mysql, and PHP up and ready in 10 minuts.

Note: This is also found on my site http://xushi.co.uk/guides/amp.php , which i'll frequently update.
Note: For the packages, i use http://www.linuxpackages.net
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
=============
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_install_db
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
=============
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
==============
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/linuxpackag...-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(); ?>
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... =)


==================================
Upgrading AMP
==================================

Upgrading is easy. This example can be used over and over again, with Apache2, php_apache2, and mysql.

Apache 2.0.54 came out recently, so i will use this as my example. To upgrade a package, simply download it from LP.net, and upgrade using upgradepkg

stop the service
=================
Before upgrading AMP, it's recommend to actually stop the service you're using first. Then start it again when done.

To stop apache, just simply type
Code:
apachectl stop
. Similarely, if you're upgrading mysql, you would stop it like so,
Code:
/etc/rc.d/rc.mysqld stop
.

download the latest apache2 (in our eg, 2.0.54)
=================
upgrade Apache2
===========
Code:
upgradepkg apache2-2.0.54-i486-1spi.tgz
This will upgrade your older 2.0.53 with the new 2.0.54 version. All the configurations should still be there, unaffected. But nevertheless, i always keep several backups of my httpd.conf files incase the worst ever happens.

restart the service
============
Finally, what's left is to start apache again. This is done through,
Code:
apachectl start
. And everything should be working again. This upgrading can be used over and over again, and is not problematic. Just frequently check LP for the latest packages for Apache2, php-apache2, and mysql.

Last edited by xushi; 07-03-2005 at 03:15 PM.
 
Old 04-09-2005, 11:11 AM   #2
Wartz
Member
 
Registered: Feb 2005
Distribution: Slackware
Posts: 52

Rep: Reputation: 15
Very nice guide. Thx xushi!
 
Old 04-09-2005, 12:32 PM   #3
xushi
Senior Member
 
Registered: Jun 2003
Location: UK
Distribution: Gentoo
Posts: 1,288

Original Poster
Rep: Reputation: 45
Quote:
Originally posted by Wartz
Very nice guide. Thx xushi!
Anytime =) Happy to help, and after my exams i'll make a more thorrough one with tutorials on how to get sendmail, phpBB, bblog, squirrelmail working in under 10 min too.
 
Old 04-10-2005, 04:58 PM   #4
otchie1
Registered User
 
Registered: Apr 2004
Posts: 560

Rep: Reputation: 30
Stunning guide xushi.

I've been meaning to sort out my apache for weeks and after reading that I'll do it right now.

Thanks again.
 
Old 04-12-2005, 08:31 PM   #5
newinlinux
Member
 
Registered: Dec 2003
Location: Next to Equator
Distribution: GNU/Linux 2.6.14
Posts: 382

Rep: Reputation: 30
Thumbs up

Thanks xushi, i followed your guide to the letter, and my AMP works now, for the 1st time i see Mambo set up page last night! BTW, care to make a write up on CMS set up too? Especially Mambo? Need some help there too....

Thanks again!
 
Old 04-13-2005, 03:17 AM   #6
xushi
Senior Member
 
Registered: Jun 2003
Location: UK
Distribution: Gentoo
Posts: 1,288

Original Poster
Rep: Reputation: 45
You're welcome newinlinux, I'd like to write about CMS, but i'm in the last month of my final year now, with my projects, dissertation, exams, and Cisco.. so i'm a bit buzy

Give me 2 months, i'll be done, and will have enough free time to make many more tutorials.. I'll post them here as well as my site.
 
Old 04-14-2005, 09:54 AM   #7
rivang
Member
 
Registered: May 2002
Location: Elkview, WV
Distribution: Slackware 10
Posts: 139

Rep: Reputation: 15
Is this the default location or do you have to do some other steps to accomplish this?

Quote:
keep the socket in /var/run/mysql/, its more secure than /tmp.
 
Old 04-15-2005, 02:01 AM   #8
xushi
Senior Member
 
Registered: Jun 2003
Location: UK
Distribution: Gentoo
Posts: 1,288

Original Poster
Rep: Reputation: 45
Quote:
Originally posted by rivang
Is this the default location or do you have to do some other steps to accomplish this?
AFAIK, yes, it's the default location. Others may prefer to have their socket in /tmp, but i've hears from fellow members that it may be insecure.
 
Old 05-13-2005, 04:52 AM   #9
Haiyadragon
Member
 
Registered: Sep 2003
Location: Gorredijk, Netherlands
Distribution: Arch Linux
Posts: 400

Rep: Reputation: 30
I get:

Code:
Syntax error on line 8 of /etc/apache2/mod_php.conf:
Invalid command 'AddType', perhaps mis-spelled or defined by a module not included in the server configuration
Any ideas on this?

edit. I fixed it. I was too dumb to check for new config files. It's ok now.

Last edited by Haiyadragon; 05-13-2005 at 05:00 AM.
 
Old 06-06-2005, 08:01 AM   #10
storm140
LQ Newbie
 
Registered: Jun 2005
Posts: 2

Rep: Reputation: 0
Quote:
Originally posted by Haiyadragon
I get:

Code:
Syntax error on line 8 of /etc/apache2/mod_php.conf:
Invalid command 'AddType', perhaps mis-spelled or defined by a module not included in the server configuration
Any ideas on this?

edit. I fixed it. I was too dumb to check for new config files. It's ok now.
Hi, I am getting the exact same error you were. Can you tell me how you fixed it?

UPDATE: I fixed it, nevermind.

Last edited by storm140; 06-06-2005 at 11:05 AM.
 
Old 06-06-2005, 11:24 AM   #11
xushi
Senior Member
 
Registered: Jun 2003
Location: UK
Distribution: Gentoo
Posts: 1,288

Original Poster
Rep: Reputation: 45
Could either one of you write down how you fixed it plz? just incase anyone else gets the problem too?

Thanks
 
Old 06-07-2005, 02:45 PM   #12
storm140
LQ Newbie
 
Registered: Jun 2005
Posts: 2

Rep: Reputation: 0
Quote:
Originally posted by xushi
Could either one of you write down how you fixed it plz? just incase anyone else gets the problem too?

Thanks
Sure. In my /etc/apache2 folder I noticed there was a file called httpd.conf.new. So I got rid of the original httpd.conf and renamed httpd.conf.new to httpd.conf, adding this line to the end of it:

Include /etc/apache2/mod_php.conf

Everything worked perfect after that. Hope this helps.
 
Old 07-31-2005, 08:04 AM   #13
dkpw
Member
 
Registered: Sep 2003
Location: Scotland
Distribution: LinuxMint16 & Ubuntu 12.0.4 LTS
Posts: 218

Rep: Reputation: 30
Thanks xushi,

This helped me with some MySQL problems.

Regards,

dkpw
 
Old 07-31-2005, 08:41 AM   #14
xushi
Senior Member
 
Registered: Jun 2003
Location: UK
Distribution: Gentoo
Posts: 1,288

Original Poster
Rep: Reputation: 45
Your welcome I'll update the URLs in it later on today.
 
Old 10-30-2005, 09:12 PM   #15
soccerkid696
LQ Newbie
 
Registered: Oct 2005
Posts: 1

Rep: Reputation: 0
This might be a dumb question but did you use Slackware 10.2? And more importantly when you were installing Slackware did you request just the basic package free of php, mysql, apache? and then installed them later like you did in this guide... or what did you do to prepare for your installation of apache, mysql, and php?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
DISCUSSION: Slackware guide for AMP Apache MySQL and PHP xushi LinuxAnswers Discussion 12 09-23-2007 01:32 PM
Apache ADVX & PHP w/ MySQL MonServeur Linux - Software 3 11-21-2004 03:11 PM
From RedHat9 to FreeBSD (Apache 2 & Mysql & PHP 4) guardian653 *BSD 5 12-11-2003 05:31 PM
Apache & PHP & Mysql thomas050682 Linux - Networking 5 03-03-2003 03:21 PM
Apache & Php & MySql te_conway Linux - Software 2 12-21-2001 04:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 10:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration