dongzhucha3999
2015-06-15 17:30
浏览 374
已采纳

如何使用php在Centos OS上显示所有正在运行的进程?

So, my php code looks like this:

exec('ps aux', $out);

Running that on Ubuntu gives me a webpage with all running processes (all users), but on Centos OS 7 it shows only the processes of the 'apache' user. Is there any way I can fix that?

EDIT: Any way, I'm running it on a VM, it's just a school project.

sample output:

apache 8758 0.0.0.1 33052 7308 ? S S 03:50 0:00 /usr/sbin/httpd - DFOREGROUND
apache 1421 0.0.0.2 5128 2780 ? R 15:24 0:00 ps aux

图片转代码服务由CSDN问答提供 功能建议

所以,我的php代码如下所示:

  exec  ('ps aux',$ out); 
   
 
 

在Ubuntu上运行它会给我一个包含所有正在运行的进程(所有用户)的网页,但是在Centos OS 7上它 仅显示'apache'用户的进程。 有什么方法可以解决这个问题吗?

编辑: 任何方式,我在VM上运行它,它只是一个学校项目。

示例输出:

  apache 8758 0.0.0.1 33052 7308?  S S 03:50 0:00 / usr / sbin / httpd  -  DFOREGROUND 
apache 1421 0.0.0.2 5128 2780?  R 15:24 0:00 ps aux 
   
 
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • duandu1966 2015-06-15 18:05
    已采纳

    The answer depends on a lot of stuff on the server side.

    More than likely what is happening is that your host is isolating your apache instances using CPU groups or similar. I would ask your host or the system admin why this is not working, but more than likely they'll just tell you they won't allow it. Allowing that sort of thing can have serious security implications.

    点赞 打赏 评论