PHP 中的 XDebug 分析 - 无法获取输出
我有一个奇怪的问题。我已经设置了 XDebug 来分析我们正在开发的 PHP 应用程序。我相信一切都设置正确,但运行时没有任何输出。我的配置如下所示:
zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so
[XDebug]
xdebug.profiler_append = 1
xdebug.profiler_enable = 0 (I've tried this both on and off)
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir = "/debug/xdebug/profiler_output_dir"
xdebug.profiler_output_name = "cachegrind.out.%p"
所有 phpinfo()
设置都按应有的方式匹配。输出目录的权限现在设置为 777,以便我可以测试它。我也尝试过使用 public_html 下的目录,但没有成功。我用来启动探查器的 URL 是:
http://example.com/my_page.php?XDEBUG_PROFILE
-or-
http://example.com/my_page.php?XDEBUG_PROFILE=1
两者都不起作用。任何帮助将不胜感激!这个应用程序的页面加载时间为 5-6 秒,我无法通过代码跟踪它。
I've got a strange issue. I've setup XDebug to profile a PHP application we're working on. I believe everything is setup correctly but I get no output when I run it. My configuration looks like this:
zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so
[XDebug]
xdebug.profiler_append = 1
xdebug.profiler_enable = 0 (I've tried this both on and off)
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir = "/debug/xdebug/profiler_output_dir"
xdebug.profiler_output_name = "cachegrind.out.%p"
All the phpinfo()
settings match up like they should. The permissions on the output directory are set to 777 right now just so I can test it. I've tried using a directory under public_html as well but no luck. The URL I'm using to launch the profiler is:
http://example.com/my_page.php?XDEBUG_PROFILE
-or-
http://example.com/my_page.php?XDEBUG_PROFILE=1
Neither works. Any help would be GREATLY appreciated!! This app has a 5-6 second page load time and I haven't been able to trace it through code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
某些发行版上的 /tmp 文件夹也存在问题,我无法在 centos 7 上获得输出,然后我发现 这个
所以,我已经设置了
chmod 777 /home/jirka/profile
现在就可以了。There is also problem with /tmp folders on some distributions, i couldnt get output on centos 7 and then i found this
So, i have set
chmod 777 /home/jirka/profile
and its ok now.注释掉
xdebug.profiler_output_dir
和xdebug.profiler_output_name
,看看是否可以在/tmp/
下找到输出。Comment out
xdebug.profiler_output_dir
andxdebug.profiler_output_name
and see whether you can find the output under/tmp/
.导致此问题的另一个可能原因是 profiler_output_dir 文件夹的权限。
向组和所有者添加写入权限为我解决了这个问题:
Another possible cause of this issue is the permissions on the folder of profiler_output_dir.
Adding write permissions to the group and owner resolved the issue for me:
另外,还要注意访问限制,例如访问权限、组、所有者和 SElinux...
Also, beware of access restrictions, such as access rights, groups, owner and SElinux...
需要完整路径,而不仅仅是路径:
The full path was required, not just the path: