You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Aram Akhavan (Aram.Akhavan)" <ar...@asu.edu> on 2018/02/21 01:33:54 UTC

[users@httpd] Environment variables not being set by php module

Hi,

I'm trying to set an environment variable and run a program via php when 
the page is loaded. This command runs fine when I use the php 
interactive shell:///|putenv('TS_SOCKET=/tmp/test.socket'); echo 
exec('tsp');|/

However, if I wrap that with php tags, throw it in a .php file and 
access it via browser, the environment variable seems to not be set at 
all (evidenced by the incorrect output of `tsp`). Setting the 
environment variable in the exec() call doesn't work either. I know its 
not a user issue, since I've run the command as the apache2 service user.

This is all running on Ubuntu 17.10 with PHP 7.1.11 on Apache 2.4.27

Why isn't this working?

Thanks,

Aram
/||/