I set an environment variable in httpd.conf:
SetEnv http_proxy "http://localhost:3128"
But I cannot get this variable in php using getenv
:
<?php
echo getenv("http_proxy");
phpinfo();
print_r($_ENV);
getenv
returns empty and print_r($_ENV)
shows the following content:
Array ( [LANG] => C [PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin [NOTIFY_SOCKET] => /run/systemd/notify )
Interestingly, the environment variable is shown under the "Apache Environment" section of the phpinfo
output.
(my system is apache 2.4/php 5.6/CentOS7)