note 59010 modified in function.popen by danbrown
| From: | danbrown@php.net | Date: | Mon, 02 Mar 2009 13:36:55 +0000 |
| Subject: | note 59010 modified in function.popen by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-151329@lists.php.net to get a copy of this message | ||
Truncated output from ps command?
The solution lies in the way ps displays it's info
specifically the -w option which:
'uses 132 columns to display information,
instead of the default which is your window size.'....
somehow with fgets in php that results in 74 characters
regardless off the init length parameter
a bit of code:
<?php
echo '<table width="99%"><tr><td>cron</td></tr>' .
"\n";
$fp=popen("/bin/ps -waux","r");
while (!feof($fp)) {
$buffer = fgets($fp, 4096);
$croninf .= '<tr><td>' . $buffer . '</td></tr>' .
"\n";
}
pclose($fp);
echo $croninf;
echo '</table><br><br>' . "\n";
?>
Ciao,
Rene =<>=
--was--
Truncated output from ps command?
The solution lies in the way ps displays it's info
specifically the -w option which:
'uses 132 columns to display information,
instead of the default which is your window size.'....
somehow with fgets in php that results in 74 characters
regardless off the init length parameter
a bit of code:
echo '<table width="99%"><tr><td>cron</td></tr>' .
"\n";
$fp=popen("/bin/ps -waux","r");
while (!feof($fp)) {
$buffer = fgets($fp, 4096);
$croninf .= '<tr><td>' . $buffer . '</td></tr>' .
"\n";
}
pclose($fp);
echo $croninf;
echo '</table><br><br>' . "\n";
Ciao,
Rene =<>=
http://php.net/manual/en/function.popen.php