LAMP on Slackware 64 13.37

As I have recently been doing some web development stuff, I thought a local web server would come in handy. I decided to configure LAMP, which in my situation stands for Linux, Apache, MySQL and PHP.

L for Linux

I have tested it with  Slackware 64 13.37 and  -current. As I usually do a full installation of Slackware which ships with all the necessary packages:


A for Apache

First we need to modify the Apache configuration file to enable PHP. Using an editor of your choice open /etc/httpd/httpd.conf and uncomment (remove # from the beginning of the line.):

Include /etc/httpd/mod_php.conf

Add ‘index.php’ to the following line:

DirectoryIndex index.html

… so that it looks like:

DirectoryIndex index.html index.php

I dual boot Slackware 13.37 and the -current branch. For that reason I decided to specify a user document directory on my shared data partition which is mounted on both systems. If you’d like to do it you need to uncomment one more line in httpd.conf:

Include /etc/httpd/extra/httpd-userdir.conf

Additionally, we need to specify the user directory in /etc/httpd/extra/httpd-userdir.conf:

UserDir /home/*/data/public_html

# Control access to UserDir directories.  The following is an example
# for a site where these directories are restricted to read-only.
<Directory “/home/*/data/public_html”>


The directory I chose to use is /home/martin/data/public_html

Let’s now make the Apache startup file executable to start it up automatically:

# chmod 755 /etc/rc.d/rc.httpd

We can start the service:

# /etc/rc.d/rc.httpd start

M for MySQL

The /etc directory contains some sample configuration files to choose from: my-huge.cnf,  my-large.cnf,  my-medium.cnf and  my-small.cnf. Pick one that best describes the role of your server. In my case the file my-small.cnf seems to be the most optimal option. As MySQL reads from /etc/my.cnf, we need to make sure it’s there.

# cp /etc/my-small.cnf /etc/my.cnf

In order to automatically start MySQL each time you start your computer, we need to make its startup script executable:

# chmod 0755 /etc/rc.d/rc.mysqld

Let’s now install the initial database:

# mysql_install_db –user=mysql

Make the database writable by the user ‘mysql’

chown -R mysql.mysql /var/lib/mysql

Let us now start the daemon and complete the installation:

# /etc/rc.d/rc.mysqld start

# mysql_secure_installation

It’ll ask you about mysql’s root password. If you haven’t set any before,  just press Enter.
Then you’ll be asked to set the root password.
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

P for PHP

Let us test if our LAMP server supports PHP. We need to create index.php in the root directory (in my case it’s /home/martin/data/public_html) and place the following code inside:




To see whether it works  open a web browser and type:


Please note that you should adjust the username. On my systems, it’d be:


If the browser displays a page containing detailed  information about the installed version of PHP, we have successfully configured a LAMP server on Slackware.

Please note that while this configuration is perfectly sufficient for my testing purposes, it might not be enough if it’s supposed to be a production machine where security is of paramount importance.

3 Replies to “LAMP on Slackware 64 13.37”

  1. Thank you. This made it very easy to setup. I’ve done it a dozen times from source, but I decided to take the easy road today, that you paved for me. 🙂

    Note: /etc/rc.d/rc.mysql start should be /etc/rc.d/rc.mysqld start

Leave a Reply

Your email address will not be published. Required fields are marked *