Apache MySQL PHP on Slackware
LAMP (Linux Apache Mysql Php) configuration with Slackware64 13.37. With full Slackware install, required software should be all installed, so it's just a matter of configuring and activating them.
If they are not installed, run below commands:
slackpkg install httpd
slackpkg install mysql
Apache2
Apache (httpd) is the web server software. It's configuration files are in /etc/httpd/. Edit the main configuration file, httpd.conf
vim /etc/httpd/httpd.conf
After editing the file, check its syntax
apachectl -t
With no error, it returns "Syntax OK".
To start the httpd server and to be sure it starts each time at boot, make the /etc/rc.d/rc.httpd file as executable and start it with the following commands:
chmod 0744 /etc/rc.d/rc.httpd
/etc/rc.d/rc.httpd start
The server started message should be displayed.
Open a web browser and point it at "http://localhost/". It should say "It Works!"
Apache2 and PHP
Open /etc/httpd/httpd.conf and look for the following section:
DirectoryIndex index.html
DirectoryIndex index.php index.html index
Next uncomment tne following line to enable/include mod_php.conf:
Include /etc/httpd/mod_php.conf
Save the file.
Open /etc/httpd/mod_php.conf and add the following in the file:
AddType application/x-httpd-php .php .php3 .php4 .php5
Save the file and restart the httpd server.
/etc/rc.d/rc.httpd restart
To test that php is functioning correctly, create index.php with the following line in it:
cd /srv/httpd/htdocs
cat > index.php
<?php phpinfo(); ?>
^D
Open up a web browser and point it to "http://localhost/index.php" It should display detailed information from phpinfo().
Once confirmed, it's a good idea to delete phpinfo() from the file for security reasons.
MySQL
There are a few different configuration files for MySQL in /etc/
- /etc/my-huge.cnf
- /etc/my-medium.cnf
- /etc/my-small.cnf
For my environment, my-small.cnf is good enough, so copy it to /etc/my.cnf
cp /etc/my-small.cnf /etc/my.cnf
Execute the following commands in this order:
chmod 0755 /etc/rc.d/rc.mysqld
mysql_install_db --user=mysql
chown -R mysql:mysql /var/lib/mysql
/etc/rc.d/rc.mysqld start
mysql_secure_installation
That's all!
-gibb
Disclaimer:
Information in this page is the result of my researches in the Internet and of my experiences. It is solely used for my purpose and may not be suitable for others.