[PHP] "DF" output
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: and this: \n"; } ?> 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?! :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] "DF" output
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 <[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] > 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" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > 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: > > > > > $data = `ps auxwww`; echo nl2br($data); > > ?> > > > > > > and this: > > > > > > > > > exec("/usr/bin/top n 1 b | head -8 | sed 's/[\$|^M]//g'", $top); > > while (list(,$line) = each($top)){ > > echo $line, "\n"; > > } > > ?> > > > > > > > > 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?! :) > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] "DF" output
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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> > > To: [EMAIL PROTECTED] > > 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" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > 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: > > > > > > > > $data = `ps auxwww`; echo nl2br($data); > > > ?> > > > > > > > > > and this: > > > > > > > > > > > > > > exec("/usr/bin/top n 1 b | head -8 | sed 's/[\$|^M]//g'", $top); > > > while (list(,$line) = each($top)){ > > > echo $line, "\n"; > > > } > > > ?> > > > > > > > > > > > > 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?! :) > > > > > > > > > -- > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] "DF" output
Joe - That is just the thing, other commands (ls, df, du, cat..etc) work fine. The fact that it the 'top' works on command line, but not in the browser initially led me to believe that it had something to do with the escape characters, after using 'sed' to remove those, I still have nothing however. Very strange issue. On Wed, 28 Mar 2001, Joe Brown wrote: > Date: Wed, 28 Mar 2001 00:30:11 -0500 > From: Joe Brown <[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] > Subject: Re: [PHP] "DF" output > > heh, > dunno, maybe the $PATH environment var doesn't include /sbin or /usr/sbin. > > Test w 'ls' see if you can get a directory listing, at least? > > "Steven Shepherd" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > 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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> > > > > To: [EMAIL PROTECTED] > > > > 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" <[EMAIL PROTECTED]> wrote in message > > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > > 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: > > > > > > > > > > > > > > $data = `ps auxwww`; echo nl2br($data); > > > > > ?> > > > > > > > > > > > > > > > and this: > > > > > > > > > > > > > > > > > > > > > > > > exec("/usr/bin/top n 1 b | head -8 | sed 's/[\$|^M]//g'", $top); > > > > > while (list(,$line) = each($top)){ > > > > > echo $line, "\n"; > > > > > } > > > > > ?> > > > > > > > > > > > > > > > > > > > > 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?! :) > > > > > > > > > > > > > > > -- > > > > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]