我想知道一种检查HTTPD进程的方法,以找出在其上运行的
PHP脚本.
我已经做了一个“netstat”,发现有些进程持有DB和网络套接字太长时间了,现在我想知道是什么脚本导致了它.
顺便说一下,我正在使用Linux.
解决方法
您需要启用Apache模块
mod_status
(CentOs主Apache配置文件位于/etc/httpd/conf/httpd.conf)
- LoadModule status_module modules/mod_status.so
使用选项ExtendedStatus on
(这将在与上面相同的配置文件中设置)
- # ExtendedStatus controls whether Apache will generate "full" status
- # information (ExtendedStatus On) or just basic information (ExtendedStatus
- # Off) when the "server-status" handler is called. The default is Off.
- #
- ExtendedStatus On
以及为此设置的一些访问权限(将XXX.XXX.XXX.XXX替换为您的IP – 这可以在与上面相同的配置文件中找到)
- # Allow server status reports generated by mod_status,# with the URL of http://servername/server-status
- # Change the ".example.com" to match your domain to enable.
- #
- <Location /server-status>
- SetHandler server-status
- Order deny,allow
- Deny from all
- Allow from localhost 127.0.0.1 XXX.XXX.XXX.XXX
- </Location>
最后,您将通过访问http://your-server-name/server-status来查看每个HTTPD进程正在执行的操作