Re: Environment variables...
| From: | David BERCOT | Date: | Wed, 14 Mar 2007 14:50:05 +0000 |
| Subject: | Re: Environment variables... | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-250570@lists.php.net to get a copy of this message | ||
Le Wed, 14 Mar 2007 15:40:28 +0100,
"Tijnema !" <tijnema@gmail.com> a écrit :
> On 3/14/07, David BERCOT <david.bercot@wanadoo.fr> wrote:
> > Hi,
> >
> > I'd like to read an environment variable with PHP.
> > I've tried with :
> > exec ('echo $CONTEXTE_D_EXECUTION',$result);
> > $result is empty !!!
> >
> > I've put the variable in /etc/environment, in /etc/profile,
> > in /etc/bash.bashrc but nothing worked...
> >
> > Do you have any idea ?
> >
> > If it is not possible, I suppose I can put a variable in php.ini ?
> >
> > Thank you very much.
> >
> > David.
> PHP is running from apache, which is running probably from the nobody
> user. This user hasn't loaded any variables i think.
I think, on Debian, it is www-data. Some variables are loaded, but I
don't know where they come from... If I find, I can add one ;-à
> So, why are you not just reading /etc/profile from php?
Yes, it is possible, but I'd like to do the same under many servers,
with different OS (RedHat, Debian for example), so, files are not at
the same place.
David.
Attachment: [application/pgp-signature] signature.asc
Attachment: [application/pgp-signature] signature.asc