20210628 - Upgrade of php fixed the page rendering issue.

Welcome to the Slackware Documentation Project

This is an old revision of the document!

Setup Apache, PHP and MySQL


In order to configure your Slackware Linux box as a MySQL-PHP -ready web server, please follow these instructions:

  • As the root user, open the '/etc/httpd/httpd.conf' Apache configuration file with your preferred text editor. Then, find the following line and uncomment it (delete the '#' character at the start of the line):
Include /etc/httpd/mod_php.conf

Now your Apache will include the PHP module when it starts.

  • Optionally (but recommended), you can configure Apache to use an 'index.php' file as your directory index. You just have to search the following line…:
 <IfModule dir_module> DirectoryIndex index.html </IfModule> 

… and change it by:

 <IfModule dir_module> DirectoryIndex index.html index.php </IfModule> 

Please note the 'index.php' part added. You can now save and close your '/etc/httpd/httpd.conf' file and restart your Apache server in order to have your modifications applied. As root, execute:

apachectl restart

  • If you want your Apache server to start automatically when you start your box, you can change the permissions of the '/etc/rc.d/rc.httpd' file. Execute the following command as root:
chmod 755 /etc/rc.d/rc.httpd

Now your Apache server will start automatically when your system boots.

In order to configure your MySQL installation, please see the Install MySQL On Slackware doc.

Final Considerations
  • Normally you would want to test your recent changes in order to know if they have worked. After restarting Apache, create a 'test.php' file on your '/var/www/htdocs/' directory with the following:
<?php phpinfo(); ?>

Now you can open your favorite web browser to the following URL: http://localhost/test.php . If you your PHP installation's settings are displayed, then you have configured your Apache correctly, otherwise, please re-check this documentation (getting sure you have followed every step correctly), or contact us at ##slackware on FreeNode.

In Other Languages
Translations of this page?:
QR Code
QR Code howtos:setup_apache_php_mysql (generated for current page)