Recently I upgraded Debian Version 11.8 to 12.4 ( bullseye -> bookworm ) This included also an upgrade of php 7.3 to 8.2 After the upgrade almost all web services were running but only one didn't. In the logs I found that the call "apache_setenv()" did rise the issue. To narrow down the issue I created a new VS with a single file "_index3.php" and this content.
<html>
<head><title>PHP Test Page</title></head>
<body>
<p>Hello World </p>
<p>setenv </p>
<?php
apache_setenv("EXAMPLE_VAR", "Example Value");
$ret = getenv("EXAMPLE_VAR");
echo $ret;
?>
<p>end of setenv </p>
</body>
</html>
When I open a browser to this server and file I get this error in the apache error logfile.
[Wed Jan 31 17:47:30.558825 2024] [proxy_fcgi:error] [pid 2445535] [client 192.168.241.29:51814] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to undefined function apache_setenv() in /opt/testserver.home.yer.at/docs/_index3.php:8\nStack trace:\n#0 {main}\n thrown in /opt/testserver.home.yer.at/docs/_index3.php on line 8'
Based on PHP documentation https://www.php.net/manual/en/function.apache-setenv.php the apache_setenv() call should be available also in version 8.
Any ideas what could cause this error and how to fix it ?