我使用 XAMPP 并对其进行了配置,以便为我在本地创建的每个项目提供虚拟主机。
在我的 php.ini 中我启用了 xdebug,我的脚本运行正常。我的意思是,任何时候 xdebug 都会报告警告、通知、错误。
现在我想启用 Xdebug 分析器,并且我对 php.ini 进行了以下更改以允许 Xdebug 分析器生成日志文件:
; xdebug.profiler_enable
; Type: integer, Default value: 0
; Enables Xdebugs profiler which creates files in the profile output directory. Those files can be
; read by KCacheGrind to visualize your data. This setting can not be set in your script with ini_set
; ().
xdebug.profiler_enable = 1
; xdebug.profiler_output_dir
; Type: string, Default value: /tmp
; The directory where the profiler output will be written to, make sure that the user who the PHP
; will be running as has write permissions to that directory. This setting can not be set in your
; script with ini_set().
xdebug.profiler_output_dir ="D:\Web Development Projects\Profile"
我重新启动了我的 Apache,但是当我运行我的脚本时,文件夹 Profile 中仍然没有生成任何文件。
还有什么我要做的吗?
为了启用分析器,我已经阅读了:http://xdebug.org/docs/profiler
经过一些研究,我在服务器中安装的 WordPress 中的 index.php 末尾添加了该代码:
echo xdebug_get_profiler_filename();
在我运行我的 WordPress 之后,在页脚我得到了这个结果:
D:/Web Development Projects/Profile/xdebug_profile._::1320916508_018294
但是当我转到文件夹时
D:/Web Development Projects/Profile/
文件没有出现在那里?有什么想法吗?
最佳答案
首先,您需要确保运行您的网络服务器的用户确实对您指定的目录具有写入权限——并且该目录必须存在。 也有可能 Xdebug 不喜欢路径中的空格,尽管这样应该可以正常工作,但我会尝试设置:
xdebug.profiler_output_dir = "D:/Web Development Projects/Profiler"
因为\+ 字符可能是一个转义序列。
关于php - Xdebug 探查器不工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8076743/