当我通过putty在控制台中运行ps ax
命令时,我得到:
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 --pid-file=/var/db/mysql/MYNAME.pid
但是当我通过php运行这个命令时:
exec('ps ax', $o);
print_r($o);
我也一样,但切割!
[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
为什么位置> = 79的所有字符都被截断?
答案 0 :(得分:2)
以下是我们在脚本中使用的技术:
exec("export COLUMNS=1000; ps ax | grep $parameter", $results);
COLUMNS
Used by the select builtin command to determine the terminal width when
printing selection lists. Automatically set upon receipt of a SIGWINCH.