I get this error:
Call to undefined function apache_getenv()
I see suggestions to just switch to getenv()
, but I don't see why I should have to since the manual implies it should be available for PHP 8. I have followed these instructions to find that it is not listed in the php.ini disabled functions.
I have tried with SELinux disabled, same problem. What gives?
One thing that I read in a comment is that the server API displayed by phpinfo()
is not Apache, but rather FPM/FastCGI. But the manual doesn't say anything about this requirement so I'd prefer to continue to use FPM/FastCGI unless I need to change it.
Any ideas about what is wrong here?
From the "Introduction" section of the Apache functions documentation:
These functions are only available when running PHP as an Apache module.
Your server API is PHP-FPM rather than mod_php, thus the functions are unavailable. This makes sense, because PHP-FPM does not integrate with Apache HTTP Server, it merely receives requests through a socket and sends response back.
I don't know about your exact use case, but $_SERVER
superglobal array tends to be the most compatible way to fetch information about your environment.