I’m hoping to get some help with an Apache/PHP 8 issue I’m encountering. Since upgrading to PHP 8 on my LAMP server, my logs have been outputting the following error:
PHP Fatal error: Uncaught Error: Call to undefined function apache_getenv() ...
I’ve done a quick debug with var_dump(is_callable('apache_getenv'))
and the value returns as bool(false)
.
I’ve attempted:
- Disabling PHP 8, restarting Apache, re-enabling PHP 8, and restarting Apache again
- Restarting my whole Linux system, system (for the heck of it)
Nothing seems to work and I’m a bit stumped on how to fix this. My application depends on a few environmental variables set in my site .conf
file, so apache_getenv
is important.
Is this just the case of a missing module or a bad install? What am I missing?
Any help would be appreciated.
For reference, my system is running Ubuntu 18.04.5
Thanks!
Advertisement
Answer
UPDATE: Based on @C. Celora’s recommendation above, getenv()
seemed to solve my overarching problem of not being able to get my environmental variables via apache_getenv()
. Thank you!
I still haven’t figured out why apache_getenv
doesn’t work on my PHP 8 install, but that’s no longer a blocker for me.