Warning: THE VOID WIKI IS DEPRECATED. It is no longer being maintained, contains outdated and incorrect information, and will eventually be shut down. Please refer to the Void Handbook, https://docs.voidlinux.org/, for the official documentation. If you can't find the information you're seeking, please raise an issue at https://github.com/void-linux/void-docs/issues

Apache HTTP Server -

From Void Linux Wiki
Revision as of 06:22, 11 November 2017 by Beli3ver (talk | contribs) (Created page with "The Apache HTTP Server, or Apache for short, is a very popular web server, developed by the Apache Software Foundation. Apache is often used...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The Apache HTTP Server, or Apache for short, is a very popular web server, developed by the Apache Software Foundation.

Apache is often used together with a scripting language such as PHP and database such as MySQL. This combination is often referred to as a LAMP stack (Linux, Apache, MySQL, PHP). This article describes how to set up Apache and how to optionally integrate it with PHP and MySQL.

Installation

Install the apache package.

# xbps-install -S apache

To setup the service, link the service file

# ln -s /etc/sv/apache /var/service

Extensions

PHP

To use PHP, first install php-apache package (which will pull in php).

# xbps-install -S php-apache

In /etc/apache/httpd.conf, comment the line:

#LoadModule mpm_event_module modules/mod_mpm_event.so

and uncomment the line:

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so


To enable PHP, add these lines to /etc/apache/httpd.conf:

  • Place this at the end of the LoadModule list:
LoadModule php7_module /ust/libexec/httpd/modules/libphp7.so
AddHandler php7-script .php

Restart httpd.service using runit.

# sv restart apache

To test whether PHP was correctly configured: create a file called test.php in your Apache DocumentRoot directory (e.g. /srv/www/apache/ with the following contents:

<?php phpinfo(); ?>

To see if it works go to: http://localhost/test.php