Hi all,
Im new to linux and slackware.
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 "updatepkg".
I wanted to upgrade to the latest versions so I downloaded packages from the following urls:
php,
mysql and
apache
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. 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 man useradd and groupadd for info on adding users.
Note: It is important that you log in as mysql for this part.
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(); ?> 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:
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>
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.