开发者

php Activity log to see which files are being executed

开发者 https://www.devze.com 2023-02-14 16:56 出处:网络
Is there any way to see active processes in PHP (li开发者_JAVA技巧ke which files are being executed)?In linux you can install apachetop. This marvellous tool scans your webserver log files showing you

Is there any way to see active processes in PHP (li开发者_JAVA技巧ke which files are being executed)?


In linux you can install apachetop. This marvellous tool scans your webserver log files showing you which files are being called it has some excellent metrics like showing which ip's are access which scripts. or which are the most popular scripts and files being called.

Another option is to use lsof which lists open files, but as files are opened and closed rather quickly it may not really help

here is a command to watch all open php files

watch -n1 "lsof | grep '\.php'"

watch -n1 is a command that repeatedly runs a command every second

The command is lsof | grep '\.php'

which means list all open files and show only the ones with a .php in the filename

I have run this on a slow webserver and saw nothing, but I tested it and it does work. It may be that the scripts are being opened and closed so fast that the command misses them.

DC


The easiest way I've found to determine which files are executing is to install the APC cache. Since the php scripts are cached, it can report the files which have/are executing.


active processes is not the same as files being executed. you can use something like htop or top to see the processes running.

get_included_files() will help with the second part http://php.net/manual/en/function.get-included-files.php


If you are profiling/debugging, the Advance PHP Debugger (APD) functions could be what you are looking for, you can call the starting point of your app to have a full call tree including parsed files and executed functions, with cumulative times and file/line locations.

0

精彩评论

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