GTKC Knowledgebase
A little bit of wisdom
Void Linux Apache and PHP installation
Posted by  Admin on


How to install Apache and PHP on Void Linux

** work in progress ***

Install Apache
xbps-install apache

Install PHP
xbps-install php

If adding virtual hosts
If you will be hosting other domains then include the vhosts.conf file.
Include /etc/apache/extra/httpd-vhosts.conf

Enable PHP
Load the PHP module and the php conf - it would probably be best to symlink the modules - e.g. ln -rs libphp8.3.so to phpcurrent.so this will alleviate the need to edit the Apache config when PHP is upgraded - you can just relink the new library to phpcurrent.so - the same can be done for php8.3_module.conf
LoadModule php_module /usr/libexec/httpd/modules/libphp8.3.so # as per above - change to phpcurrent.so if desired
Include /etc/apache/extra/php8.3_module.conf

Change the worker module
Upon starting Apache with PHP enabled I got the following message: Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe.
So I had to disable the mpm_worker module and enable the mpm_prefork module.
# LoadModule mpm_event_module /usr/libexec/httpd/mod_mpm_event.so
LoadModule mpm_prefork_module /usr/libexec/httpd/mod_mpm_prefork.so
#LoadModule mpm_worker_module /usr/libexec/httpd/mod_mpm_worker.so


The default document root
This is set to /srv/www/apache
If you plan to host other virtual hosts this can be ignored
DocumentRoot "/srv/www/apache"

I also added a ports.conf (as in Debian + others)
I added a ports.conf to simplify virtual hosting.
Include /etc/apache/ports.conf

# ports.conf
#
Listen 127.0.0.1:80
Listen your.ip.address:80


	# Listen 443
	# Listen your.ip.address:443



	# Listen 443
	#Listen your.ip.address:443


# vim: syntax=apache ts=4 sw=4 sts=4 sr noet


Edit http-default.conf as follows
Edit /etc/apache/extra/httpd-default.conf
Change:
ServerTokens Full
to
ServerTokens Prod

If using SSL
SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
SSLCipherSuite HIGH:!aNULL:!MD5:!3DES
SSLHonorCipherOrder on
SSLCompression          off


Tags: Void Linux , Linux , Apache , PHP

Return to home page: Home