• Hi, Pleskians! We are running a UX testing of our upcoming product intended for server management and monitoring.
    We would like to invite you to have a call with us and have some fun checking our prototype. The agenda is pretty simple - we bring new design and some scenarios that you need to walk through and succeed. We will be watching and taking insights for further development of the design.
    If you would like to participate, please use this link to book a meeting. We will sent the link to the clickable prototype at the meeting.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • The ImunifyAV extension is now deprecated and no longer available for installation.
    Existing ImunifyAV installations will continue operating for three months, and after that will automatically be replaced with the new Imunify extension. We recommend that you manually replace any existing ImunifyAV installations with Imunify at your earliest convenience.

Question Apache Web Server Settings (mod_setenvif)

siteturbo

New Pleskian
Server operating system version
AlmaLinux 9.5
Plesk version and microupdate number
Plesk Obsidian 18.0.67 Update #3
Hello,

I'm new to Plesk. I am in the Apache Web Server Settings and I want to enable the mod_setenvif module for Apache. However, I see no option or setting for it. How do I enable mod_setenvif or install it?

Thank you.
 
That module should be loaded by default. There should not be any need to add it manually. If it is not loaded by default, first check in /etc/httpd/modules (points to /usr/lib64/httpd/modules) whether the file mod_setenvif.so exists. If it exists, you can create a config file in /etc/httpd/conf.modules.d similar to any one existing, e.g. with only the line LoadModule setenvif_module modules/mod_setenvif.so in it, then test the configuraton # apachectl -t, and if gives you no errors, reload the configuration # service httpd reload.
 
That module should be loaded by default. There should not be any need to add it manually. If it is not loaded by default, first check in /etc/httpd/modules (points to /usr/lib64/httpd/modules) whether the file mod_setenvif.so exists. If it exists, you can create a config file in /etc/httpd/conf.modules.d similar to any one existing, e.g. with only the line LoadModule setenvif_module modules/mod_setenvif.so in it, then test the configuraton # apachectl -t, and if gives you no errors, reload the configuration # service httpd reload.

Thanks for you reply.

Inside the file /etc/httpd/conf/httpd.conf there is a call for include conf.modules.d/*.conf

Inside the file /etc/httpd/conf.modules.d/00-base.conf there is a call to LoadModule setenvif_module modules/mod_setenvif.so

I have restarted apache, yet it still doesn't load the module.

I run plesk sbin httpd_modules_ctl -s but the setenif_module does not even show up in the list of modules, it's not even in the list. It's as if it doesn't exist. However, it does exist, because the file /etc/httpd/modules/mod_setenvif.so is there on the server.

So, the file /etc/httpd/modules/mod_setenvif.so is there and the call LoadModule setenvif_module modules/mod_setenvif.so is being made to load it. However, it's not being loaded. It also never shows in inside the Plesk Apache Web Server Settings showing the available modules.
 
What's the output of # apachectl -M | grep setenvif or # httpd -M | grep setenvif?

When you do a real life test, what's the result? For example:
Add this line to your .htaccess file:
SetEnvIf Request_URI "^/testmodsetenvif$" TEST_MOD_SETENVIF_LOADED=1
Then create a simple script to check the environment variable:
<?php if (getenv('TEST_MOD_SETENVIF_LOADED')) {echo "mod_setenvif is loaded!";} else {echo "mod_setenvif is NOT loaded.";}?>
If you access the script through your browser, you should see "mod_setenvif is loaded!".
 
Last edited:
At least we now know for sure that the module is present, is loaded and is active in the web server.

So the question remains why the environment variable stays invisible to your PHP.

Let's please check whether this alternative PHP script returns the correct answer:
Code:
<?php
if (apache_getenv('TEST_MOD_SETENVIF_LOADED')) {
    echo "mod_setenvif is loaded!";
} else {
    echo "mod_setenvif is NOT loaded.";
}
?>
 
And for PHP-FPM it is possible that you need to set the environment variables in the additional PHP directives section like
Code:
[php-fpm-pool-settings] 
env[your_env_variable]="your variable value"
This may not be the desired solution, but at least you're getting closer to some solution.
 
At least we now know for sure that the module is present, is loaded and is active in the web server.

So the question remains why the environment variable stays invisible to your PHP.

Let's please check whether this alternative PHP script returns the correct answer:
Code:
<?php
if (apache_getenv('TEST_MOD_SETENVIF_LOADED')) {
    echo "mod_setenvif is loaded!";
} else {
    echo "mod_setenvif is NOT loaded.";
}
?>


I get no result for that script running the apache_getenv() function. It breaks/stops the script.
 
Back
Top