After a new install of Slackware 12.2, I carried out the following procedures to get everything working successfully right out of the box.
The server is a standalone system, used for testing and educational purposes, so please bear that in mind.
NB: Throughout this post when you see a single # at the start of a line it means you are typing the commands as root user. You should not include the #, only the text after it.
### setup Apache with php enabled
Login as root user on your Slackware box and type:
# pico -w /etc/httpd/httpd.conf
Press CTRL+w to search and type mod_php.conf to find this line:
#Include /etc/http/mod_php.conf
Uncomment it, just remove the
# from the begining of the line.
Also find the following line:
DirectoryIndex index.html
Change it to this:
DirectoryIndex index.html index.htm index.php default.htm
Save the file and exit ( press CTRL+x ). Now type this:
# chmod 755 /etc/rc.d/rc.httpd
# /etc/rc.d/rc.httpd start
If the httpd server is not already running, you should have Apache and php running. Your web file root directory is:
/var/www/htdocs
If you receive the message "
httpd (pid 12345) already running" (
NB: pid is just here for example and can be any value), type this:
# /etc/rc.d/rc.httpd restart
Open your browser and go to
http://localhost/ and you should see this big bold message on a blank white page:
It Works!
### Extra - test php is working ###
To test php is working, back on the command line type this:
# pico -w /var/www/htdocs/info.php
Copy and paste the following text into the pico text editor, or type it:
<?php
phpinfo();
?>
Press CRTL+x and save the file as info.php, or any filename you like with the .php extension.
In your browser go to
http://localhost/info.php (or the filename you chose, obviously!)
You should be presented with a nice page full of information which means php is working perfectly.
### setup MySQL (secure installation)
Still logged in as root user, to setup MySQL type this:
# chmod 755 /etc/rc.d/rc.mysqld
# mysql_install_db
# chown -R mysql:mysql /var/lib/mysql
# cp /usr/share/mysql/mysql.server /etc/rc.d/rc.mysql
# chmod 755 /etc/rc.d/rc.mysql
# /etc/rc.d/rc.mysql start
# /usr/bin/mysqladmin -u root password 'password'
** (
NB: the password for MySQL root user will now be:
password )
# mysql_secure_installation
Enter your password when requested ( password is:
password ), follow the prompts, answering ALL questions. Then type:
# /etc/rc.d/rc.httpd restart
Now the MySQL database should be running too.
#### install phpMyAdmin 3.1.1
Again, as root user type:
# cd /var/www/html
# wget http://ovh.dl.sourceforge.net/source...english.tar.gz
# tar zxvf phpMyAdmin-3.1.1-english.tar.gz
# mv phpMyAdmin-3.1.1-english phpmyadmin
# cd phpmyadmin
# cp config.sample.inc.php config.inc.php
# pico -w config.inc.php
Now edit this line by putting anything between the quotes:
( The example here is 'your_text', you can use any letter or number combination but NO special chars! )
$cfg['blowfish_secret'] = 'your_text'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
Also change 'cookie' to 'http' on this line:
$cfg['Servers'][$i]['auth_type'] = 'http';
exit and save ( press CRTL+x )
# /etc/rc.d/rc.httpd restart
Open your browser and go to
http://localhost/phpmyadmin/ and you should be presented with either a login prompt or the phpMyAdmin interface, depending on your selections during the MySQL secure install process.
user:
root
password:
password
NB: if you changed the mysql root password, during the secure installation, use the
new password.
### eof
I thought this might be a good idea for new(ish) Slackware users as there seems to be a little confusion about setting up Apache/php/MySQL.
Any corrections, additions, advice, suggestions or otherwise are, of course, gladly welcome. :>