#1112461 apache2: environment variables are not available in script when using the Action directive

Package:
apache2
Source:
apache2
Description:
Apache HTTP Server
Submitter:
Marek Chlup
Date:
2025-08-29 16:15:02 UTC
Severity:
normal
Tags:
#1112461#5
Date:
2025-08-29 15:51:23 UTC
From:
To:
Hi.

After upgrading from Debian 12 (with apache2 2.4.62-1~deb12u2) to Debian
13 (with apache 2.4.65-2), my scripts interpreted by eperl (2.2.15-1),
which are invoked via the Action directive in the Apache configuration,
stopped working correctly. The problem is that the scripts do not have
environment variables available. They are missing environment variables
set with SetEnv, as well as other environment variables such as
DOCUMENT_ROOT.

For troubleshooting I assembled the complete apache2 config httpd.conf
(see below), which I run as an unprivileged user with the commands:
export APACHE_COREPATH="/usr/lib/apache2"
export APACHE_COREPATH2=`pwd`
/usr/sbin/apachectl -D FOREGROUND -f ${APACHE_COREPATH2}/httpd.conf

My script then returns all environment variables and the result can be
retrieved, for example, with:
elinks http://localhost:9083/a.phtml

On Debian 13 the script returns (is BAD):
"
ENV vars
-------------------------                                                     
REDIRECT_MYCONF_VAR = Hello

Got the following headers
-------------------------                                                     

"

On Debian 13 the script returns (is OK):
"
ENV vars
-------------------------
CONTEXT_DOCUMENT_ROOT = /usr/lib/cgi-bin/
CONTEXT_PREFIX = /cgi-bin/
DOCUMENT_ROOT = ...
GATEWAY_INTERFACE = CGI/1.1
...
HTTP_X_MYCONF_VAR = Hello-Header
HTTP_X_MYCONF_VAR2 = Bye-Header
MYCONF_VAR = Hello
MYCONF_VAR2 = Bye
...
SERVER_SOFTWARE = Apache/2.4.62 (Debian)
VERSION_INTERPRETER = ePerl/2.2.14
VERSION_LANGUAGE = Perl/5.036

Got the following headers
-------------------------
HTTP_USER_AGENT: ELinks/0.13.2 (textmode; Linux 6.1.0-37-amd64 x86_64; ...
HTTP_X_MYCONF_VAR: Hello-Header
HTTP_CONNECTION: Keep-Alive
HTTP_ACCEPT_LANGUAGE: cs
HTTP_ACCEPT: */*
HTTP_X_MYCONF_VAR2: Bye-Header
HTTP_HOST: localhost:9083
"

The source code of the script a.phtml is:
<?
use strict;
use utf8;
print "Content-Type: text/plain\n\n";
print "ENV vars\n";
print "-------------------------\n";
foreach my $var (sort keys %ENV) {
   print $var;
   print " = ";
   print $ENV{$var};
   print "\n";
}
print "\n";
use CGI;
my $q = CGI->new;
my %headers = map { $_ => $q->http($_) } $q->http();
print "Got the following headers\n";
print "-------------------------\n";
for my $header ( keys %headers ) {
   print $header;
   print ": ";
   print $headers{$header};
   print "\n";
}
!>

The problem is probably not in the apache2 package itself on Debian 13.

I built a vanilla Apache 2.4.62 on Debian 13 (the version corresponding
to Debian 12, where there is no problem) and there the problem (on
Debian 13) also occurs: environment variables are not available in the
script.

I also built a vanilla Apache 2.4.65 on Debian 12 (the version
corresponding to Debian 13, where the problem occurs) and there the
problem does not occur (on Debian 12).

This seems odd to me - something in Debian 13 must have changed
(probably not in apache2 itself) that causes my problem.

Best Regards
Marek