Re: Checking Server Status with PHP

From: Andrew _at_ Rockface (_at_)
Date: 01/30/05


Date: Sun, 30 Jan 2005 13:25:30 +0000 (UTC)

David Quinton wrote:
> On Sat, 29 Jan 2005 09:48:58 +0000 (UTC), "Andrew @ Rockface"
> <andrew@rockface-records.co.uk> wrote:
>
>> exec() only returns the last line of output from the shell command,
>> whilst backticks (graves) return all output from the shell command.
>
> Hope you don't mind this "thread hijack", but it is related...
>
> We have a PHP page which exec()s lynx to read a local html file and
> write it out as text.
>
> This worked fine until a few days ago, now it only writes zero length
> text files. Same happens if I use system() instead of exec().
>
> If I run the command from shell, as the web user (the same user that
> PHP/Apache is running under), it writes the text file correctly.
>
> Other PHP scripts which use exec() to write files, but which don't run
> Lynx, write out perfectly.
>
> What could I have done? Or maybe some upgrade our hosting company has
> carried out? Any clues?

A bit strange. Sounds like permissions except that it does write the file
(just zero bytes) and you can do it from shell as the correct user. Try
doing a phpinfo() to check your php config. Like you say, it looks like your
host changed something.



Relevant Pages

  • Re: executing shell commands
    ... #> the shell command as a list of lines. ... If I use exec for this, ... #> How do I do this in tcl ... puts suppress ...
    (comp.lang.tcl)
  • How to change current directory in Expect Script?
    ... I already tried "EXEC" command, EXEC can execute many shell command, ... In my script, I need change to TFTP directory to FTP download a file, ...
    (comp.lang.tcl)
  • Re: Checking Server Status with PHP
    ... exec() only returns the last line of output from the shell command, ... backticks return all output from the shell command. ... execit would still work but if there were more than one httpd process ... to grab all httpd pids it would be best to use backticks. ...
    (alt.php)
  • Re: Checking Server Status with PHP
    ... >backticks return all output from the shell command. ... Same happens if I use systeminstead of exec(). ... If I run the command from shell, as the web user (the same user that ... Other PHP scripts which use execto write files, ...
    (alt.php)
  • [UNIX] PHP Multibyte Shell Command Escaping Bypass Vulnerability
    ... PHP Multibyte Shell Command Escaping Bypass Vulnerability ... variable width character set like GBK, EUC-KR, SJIS, .. ...
    (Securiteam)