LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Linux Answers > Networking
User Name
Password

Notices

By Tiepo at 2006-06-18 01:29
Recently I have setup PHP, MySql and Apache on my Slackware 10.2 machine. I have written this step-by-step guide in the hope that it will help other newbies. I hope you find it informative.

At the bottom of this guide are some steps on testing Apache, MySql and PHP.

I started by installing the packages with the cd during the installation of slackware.

Note: If you haven't installed the packages before hand simply download the packages linked below and type installpkg packagename instead of upgradepkg.

I wanted to upgrade to the latest versions so I downloaded packages php-5.1.4, mysql-5.0.22 and apache2-2.0.58 from http://www.linuxpackages.net

I then went into the console and browsed to the directories I had downloaded them to using cd.

As root. I then installed all 3 packages by typing: upgradepkg packagename

After I had installed all 3 packages I stoped Apache by typing into the console: apachectl stop

I then typed into the console: locate httpd.conf (Skip the bold part if you found it)

Note: To find httpd.conf you may first need to Create slocate database

To do this simply type: locate -u (This will create the slocate database in whatever folder you happen to currently be in.

Now type updatedb In the console to update the database.
and then type: locate httpd.conf


Now edit httpd.conf using Kwrite or a similar program.

Search inside the file for "LoadModule rewrite_module lib"(hit ctrl + f to search).

Underneath this line type: LoadModule php5_module /usr/lib/apache2/libphp5.so

The directories above just happens to be were my "libphp5.so" file happens to be for me. Type in console: locate libphp5.so

That will tell you were your libphp5.so file is.

Now search the file (ctrl +f) for "AddType application/x-gzip"
Underneath this line add the following two lines:

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


Save httpd.conf


Now go back into console and type: apachectl start

PHP and Apache should now be working.

Now go into console. Type: su mysql (I am assuming that slackware created this account) If the user doesn't exist type [i]man useradd and groupadd[i/] for info on adding users.

[b]Note: It is important that you log in as mysql for this part.[b/]

Now locate mysql_install_db then browse to the folder in the console. Then type mysql_install_db

Then log back in as root using su root

Type in console: chown -R mysql:mysql /var/lib/mysql

This gives mysql user and mysql group owner rights to the folder.

Note: Your folder may be at a different location. Simply locate ibdata1 to find the correct folder.

Now locate rc.mysqld

On my hard drive it is located in: /etc/rc.d/

Now type into console: /etc/rc.d/rc.mysqld start (substitute etc/rc.d/ with were it is located on your computer).

TESTING
Apache - Simply start apache by typing "apachectl start"
Then go into your web browser and type "localhost" if apache works you will see a html page telling you so.

PHP - After editing httpd.conf you need to restart apache. locate htdocs folder and open up kedit. Type "<?php phpinfo(); ?>" (without quotes) save the file in the htdocs folder as phpinfo.php then open up your web browser. Type "http://localhost/phpinfo.php" If PHP is working then a whole lot of information will be printed in your browser with a purple php header.

Mysql - To check that mysql is working simply type: mysql
into the console. If it works the following will print out:

[i]Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.0.22-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>[i] (type "exit" to get out of the mysql console.)

Hopefully PHP, MySQL and Apache is now working on your computer.

Thankyou to all those people who helped me (Bread, Davus, Johno and Alex) setup php,mysql and apache and thankyou for all your patience.


  



All times are GMT -5. The time now is 07:10 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration