note 59010 added to function.popen
| From: | rjl at xs4all dot nl | Date: | Wed, 23 Nov 2005 21:16:57 +0000 |
| Subject: | note 59010 added to function.popen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-98999@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:
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 =<>=
----
Manual Page -- http://www.php.net/manual/en/function.popen.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+59010
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59010&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59010&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59010&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59010&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59010&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59010&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59010&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+59010&report=yes
Search -- http://master.php.net/manage/user-notes.php