Search code examples
apachexamppapache2mod-env

How to enable mod_env in Apache


I'm trying to set Environment variables for PHPMailer and need to enable mod_env in the httpd.conf. I know if you're using Apache (and mod_env is enabled), then Envirnoment variables can be specified in .htaccess. Here is my httpd.conf in XAMPP:

Alias /bitnami/ "/Applications/XAMPP/xamppfiles/apache2/htdocs/"
Alias /bitnami "/Applications/XAMPP/xamppfiles/apache2/htdocs

<Directory "/Applications/XAMPP/xamppfiles/apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>

Solution

  • mod_env is loaded or enabled like every other module, with the LoadModule directive. It's probably already enabled. If it isn't, the pattern will be quite obvious.

    You can check loaded modules with apachectl -M

    If you want to use directives provided by mod_env, like "SetEnv" you'll have to actually look up their syntax in the manual and type them into your configuation.