OK, then I think the problem is with Apache. I do remember it has some
module that requires the variables
to be explicitly listed in config file.

I created this issue: https://github.com/openshift/sti-php/issues/83 so you
can track the fix.

On Thu, Feb 18, 2016 at 12:50 PM, Lorenz Vanthillo <
[email protected]> wrote:

> Hi,
>
> I tried just the same with a new variable: MYVAR. This is no reserved
> variable. But also this seems not to work.
>
> ------------------------------
> From: [email protected]
> Date: Thu, 18 Feb 2016 12:30:06 +0100
> Subject: Re: Environment variable in OpenShift
> To: [email protected]
> CC: [email protected]
>
>
> I think this is because USER is reserved variable (it contains the name of
> the user that runs the container).
> Since in OpenShift the container is running as random UID and the PHP
> image does not have nss_wrapper
> to assign a "name" to the random UID, that variable is empty. We can add
> nss_wrapper to the image to
> populate that var.
>
>
>
> On Thu, Feb 18, 2016 at 11:59 AM, Lorenz Vanthillo <
> [email protected]> wrote:
>
>
> I want to show an env var in my docker container. The PHP script looks
> like this:
>
> <html>
>  <head>
>   <title>Show Use of environment variables</title>
>  </head>
>  <body>
>   <?php
>   print "env is: ".$_ENV["USER"]."\n";
>   ?>
>  </body>
> </html>
>
> I use OpenShift to start the container (s2i-build). After curling to the
> service of the PHP - container:
>
> env is:
>
> Now I change the dc config of my container:
>
> oc env dc/envar USER=Pieter
> deploymentconfig "envar" updated
>
> When I access the container. The env var of USER is Pieter
>
> docker exec -it 44a0f446ae36 bash
> bash-4.2$ echo $USER
> Pieter
>
> But my script remains showing: "env is:" It does not fill in the variable.
>
>
> What's the reason for this? The env variable is really there.
>
>
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.openshift.redhat.com/openshiftmm/listinfo/users
>
>
>
_______________________________________________
users mailing list
[email protected]
http://lists.openshift.redhat.com/openshiftmm/listinfo/users

Reply via email to