Re: "DF" output
| From: | Steven Shepherd | Date: | Tue, 27 Mar 2001 20:18:48 +0000 |
| Subject: | Re: "DF" output | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-45776@lists.php.net to get a copy of this message | ||
Brad,
Thanks for the response. Either method they both work via command
line. Neither of them work in the browser.
On Tue, 27 Mar 2001, Brad S. Jackson wrote:
>
> Try $top =
top n 1 b | head -8 | sed 's/[\$|^M]//g';
>
> In my experience, you can't use | in exec calls, you have to use the back tick
> method.
>
>
> Steven Shepherd <steven@gate.net> wrote:
> Bad example (changed to ps and it works actually..but i dont want 'ps', I
> want 'top'). Ran top using su to the user 'www' from the command line and
> was able to run it fine.
>
> On Tue, 27 Mar 2001, Joe Brown wrote:
>
> > Date: Tue, 27 Mar 2001 12:35:08 -0500
> > From: Joe Brown <joebrown@somewhere.com>
> > To: php-general@lists.php.net
> > Subject: Re: [PHP] "DF" output
> >
> > nobody has execute permission on ps?
> >
> > Probably quite the opposite, your webserver user doesn't have execute
> > permission on ps, so there is no execution or return value.
> >
> > "Steven Shepherd" <steven@gate.net> wrote in message
> >
> > news:Pine.A41.4.21.0103271214080.47822-100000@inca.gate.net...
> > > I am writing a script, actually modifying PhPSysInfo to include the top
> > > processes used on a machine. So far, no matter what I do, I can only get
> > > it to work via the command line. I get a blank screen when trying it via
> > > the browser:
> > >
> > > Tried this:
> > >
> > > <?php
> > > $data = ps auxwww; echo nl2br($data);
> > > ?>
> > >
> > > ------------------------------------------------
> > > and this:
> > >
> > > <TT>
> > > <PRE>
> > > <?php
> > > exec("/usr/bin/top n 1 b | head -8 | sed 's/[\$|^M]//g'", $top);
> > > while (list(,$line) = each($top)){
> > > echo $line, "<BR>\n";
> > > }
> > > ?>
> > > </PRE>
> > > </TT>
> > >
> > > I used sed to remove control characters..etc. Again, both examples above
> > > work via the command line, but not via a browser. User "www" is able to
> > > run this command as well, so it's not permissions. Help?! :)
> > >
> > >
> > > --
>
>
>