简体   繁体   English

PHP(Linux):列出已执行的文件

[英]PHP (Linux): list files that have been executed

I'm debugging fairly complex PHP/AngularJS application written in custom framework. 我正在调试使用自定义框架编写的相当复杂的PHP / AngularJS应用程序。 Documentation is almost non-existent and there is are no clear naming and folder conventions. 文档几乎不存在,也没有明确的命名和文件夹约定。

The biggest challenge for me is finding which files were executed in a particular request. 对我来说最大的挑战是查找在特定请求中执行了哪些文件。 The application has several different ways of autoloading and it has over 4500 PHP files. 该应用程序具有几种不同的自动加载方式,并且具有4500多个PHP文件。

Is it possible to find out which files were executed without modifying the code of application? 是否可以在不修改应用程序代码的情况下找出执行了哪些文件? I'm running Ubuntu 15.10. 我正在运行Ubuntu 15.10。

If no, what would be the next best way to do this? 如果没有,那么执行此操作的下一个最佳方法是什么? I'm aware of get_included_files function, but I don't think it would help me here. 我知道get_included_files函数,但是我认为这不会对我有帮助。

Thanks in advance. 提前致谢。

I'm not sure that you can find out this without modifying your application code. 我不确定您是否可以在不修改应用程序代码的情况下找到答案。

But I think that for the PHP part debug_backtrace could help, if you know where your endpoint is. 但是我认为,如果您知道端点在哪里,那么对于PHP部分来说debug_backtrace可能会有所帮助。 With this you can reproduce one process, like a exception stacktrace. 这样,您可以重现一个进程,例如异常堆栈跟踪。

Another one: you could use a debugger like xdebug and go through the system with some brakepoints, so that you can see how the application flow is. 另一个:您可以使用xdebug之类的调试器,并通过一些制动点来检查系统,以便了解应用程序的流程。

Assuming you have a dedicated test environment, then make sure the cache is oversized, run your tests and see what got loaded into the opcode cache. 假设您有一个专用的测试环境,然后确保高速缓存过大,运行测试并查看加载到操作码高速缓存中的内容。 For newer PHP installations, use opcache_get_status () for the older, APC cache, use apc_cache_info () 对于较新的PHP安装,使用opcache_get_status ()对于上了年纪,APC缓存,使用apc_cache_info ()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM