php environment array

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ron Croonenberg

    php environment array

    Hello,

    I don't know that much about php but I was asked this question :

    we have a testbox running Linux, Apache-1-3-29 and PHP/4.3.4

    echo "<b>ENV</b><br>";
    foreach($_ENV as $Name1=>$Key1)
    { echo $Name1." is: ".$Key1."<b r>";
    }

    when this is executed it says somewhere that the logname is root.

    However the apache server is running under the uid apache and group apache.

    I suspected that when this is executed it would say that the logname is
    apache or am I wrong assuming that ?

    thanks,

    Ron



  • Pedro Graca

    #2
    Re: php environment array

    Ron Croonenberg wrote:[color=blue]
    > we have a testbox running Linux, Apache-1-3-29 and PHP/4.3.4
    >
    > echo "<b>ENV</b><br>";
    > foreach($_ENV as $Name1=>$Key1)
    > { echo $Name1." is: ".$Key1."<b r>";
    > }
    >
    > when this is executed it says somewhere that the logname is root.[/color]

    I don't have that environment variable.
    [ Debian GNU/Linux; Apache 1.3.29; php 4.3.3 ]


    When I run phpinfo() Apache User/Group is "www-data" as expected.


    If I do

    $ ps aux|grep apache|grep -v grep

    I get returned

    root 1021 0.0 0.3 143764 1304 ? S Feb10 0:00 /usr/sbin/apache
    www-data 1049 0.0 1.1 144056 4544 ? S Feb10 0:01 /usr/sbin/apache
    ....
    (lots more "www-data")
    --
    --= my mail box only accepts =--
    --= Content-Type: text/plain =--
    --= Size below 10001 bytes =--

    Comment

    • Ron Croonenberg

      #3
      Re: php environment array

      Here's an excerpt of the script I use :

      <?php //preprocessing of form data

      echo "<b>ENV</b><br>";
      foreach($_ENV as $Name1=>$Key1)
      { echo $Name1." is: ".$Key1."<b r>";
      }
      ?>


      I think it is supposed to run on any php/apache combination.

      Ron



      Pedro Graca wrote:
      [color=blue]
      > Ron Croonenberg wrote:
      >[color=green]
      >>we have a testbox running Linux, Apache-1-3-29 and PHP/4.3.4
      >>
      >>echo "<b>ENV</b><br>";
      >>foreach($_E NV as $Name1=>$Key1)
      >>{ echo $Name1." is: ".$Key1."<b r>";
      >>}
      >>
      >>when this is executed it says somewhere that the logname is root.[/color]
      >
      >
      > I don't have that environment variable.
      > [ Debian GNU/Linux; Apache 1.3.29; php 4.3.3 ]
      >
      >
      > When I run phpinfo() Apache User/Group is "www-data" as expected.
      >
      >
      > If I do
      >
      > $ ps aux|grep apache|grep -v grep
      >
      > I get returned
      >
      > root 1021 0.0 0.3 143764 1304 ? S Feb10 0:00 /usr/sbin/apache
      > www-data 1049 0.0 1.1 144056 4544 ? S Feb10 0:01 /usr/sbin/apache
      > ...
      > (lots more "www-data")[/color]

      Comment

      Working...