开发者

Output from console commands run thru php get cutted

When I run ps ax command in console via putty I get:

1053  ??  Ss     0:45.47 /usr/local/sbin/nrpe2 -d -c /usr/local/etc/nrpe.cfg
1085  ??  Is     0:00.03 /bin/sh /usr/local/bin/mysqld_safe --defaults-extra-file=/var/db/mysql/my.cnf --user=mysql --datadir=/var/db/mysql 开发者_如何学JAVA--pid-file=/var/db/mysql/MYNAME.pid

But when I run this command via php:

exec('ps ax', $o);
print_r($o);

I get the same, but cutted!

[27] =>  1053  ??  Ss     0:45.48 /usr/local/sbin/nrpe2 -d -c /usr/local/etc/nrpe.cfg
[28] =>  1085  ??  Is     0:00.03 /bin/sh /usr/local/bin/mysqld_safe --defaults-extra-f

Why are all characters from position >=79 truncated?


Here's the technique we used on our script:

exec("export COLUMNS=1000; ps ax | grep $parameter", $results);

Here's what COLUMNS means:

COLUMNS
   Used by the select builtin command to determine the terminal width when 
   printing selection lists. Automatically set upon receipt of a SIGWINCH. 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜