【问题标题】:I can not see all process on Unix using Apache我看不到使用 Apache 的 Unix 上的所有进程
【发布时间】:2016-01-03 08:35:38
【问题描述】:

我正在尝试使用 Apache 在服务器上运行进程。 我尝试过 PHP、Perl 和 Bash 脚本并使用了以下命令:

exec('ps -u username -o pid,uname,cmd,pmem,pcpu,etime --sort=-pcpu  > test.txt'); 

exec('ps -u username -o pid,uname,cmd,pmem,pcpu,etime --sort=-pcpu', $output);

exec('ps -A', $output); 

等等……

我只得到所有/ USR / SBIN / HTTPD -k restart 进程。

但是当我在 SSH(终端)上尝试这个命令时,我正确地获取了所有进程。

我认为问题出在 Apache。

任何人都知道我可以如何解决这个问题并使用 Apache 获取所有进程。 提前感谢

【问题讨论】:

  • 这部分是权限问题。 Web服务器通常以“nobody”或“www”等用户身份运行,并且无法像root一样看到所有进程。

标签: php linux bash apache perl


【解决方案1】:
# chcon -t unconfined_exec_t /sbin/httpd

【讨论】:

  • @ChankeyPathak,请您扩展您的答案吗?它应该做什么?
  • chcon: 无法访问`/sbin/httpd': 没有这样的文件或目录
【解决方案2】:

使用命令 ps x 将列出所有活动进程

【讨论】:

  • 不,这没有帮助。在 SSH 上没问题,但是使用 Apache 我仍然只能重新启动 /usr/sbin/httpd -k restart /usr/sbin/httpd -k restart /usr/sbin/httpd -k restart /usr/sbin/httpd -k restart /usr/sbin/httpd -k 重启 /usr/sbin/httpd -k 重启 /usr/sbin/httpd -k 重启 /usr/sbin/httpd -k 重启 /usr/sbin/httpd -k 重启 /usr/sbin/ httpd -k 重启 /usr/sbin/httpd -k 重启 /usr/sbin/httpd -k 重启 /usr/sbin/httpd -k 重启 /usr/sbin/httpd -k 重启
猜你喜欢
  • 1970-01-01
  • 2012-04-20
  • 2013-05-18
  • 2019-10-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-03-20
  • 1970-01-01
相关资源
最近更新 更多