windows Xdebug 分析器不起作用?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8076743/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 18:26:20  来源:igfitidea点击:

Xdebug profiler is not working?

phpwindowsxdebug

提问by Merianos Nikos

I using XAMPP and I have configure it in order to have virtual hosts for each project I create localy.

我使用 XAMPP 并对其进行了配置,以便为我在本地创建的每个项目拥有虚拟主机。

In my php.ini I have enabled xdebug, and my scripts are working properly. I mean that any time there is a warning, notice, error, are reported by the xdebug.

在我的 php.ini 中,我启用了 xdebug,并且我的脚本工作正常。我的意思是任何时候有警告、通知、错误,都是由 xdebug 报告的。

Now I would like to enable the Xdebug profiler, and I have make the following changes into my php.ini in order to allow the Xdebug profiler to generate the log file:

现在我想启用 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"

I restart my Apache, but still when I run my scripts there is no file generated in folder Profile.

我重新启动了我的 Apache,但是当我运行我的脚本时,文件夹 Profile 中仍然没有生成文件。

Is there anything else I have to do ?

还有什么我需要做的吗?

I have read that in order to enable the Profiler : http://xdebug.org/docs/profiler

我已经阅读了为了启用探查器:http: //xdebug.org/docs/profiler



After some research, I add that code at the end of the index.php in a WordPress installation I have in my server:

经过一番研究,我在服务器中的 WordPress 安装中的 index.php 末尾添加了该代码:

echo xdebug_get_profiler_filename();

After I run my WordPress, at the footer I get that result:

在我运行我的 WordPress 后,在页脚我得到了这个结果:

D:/Web Development Projects/Profile/xdebug_profile._::1320916508_018294

but when I go to the folder

但是当我去文件夹时

D:/Web Development Projects/Profile/

the file is not appeared there ? Any idea ?

文件没有出现在那里?任何的想法 ?

采纳答案by Derick

First of all, you need to make sure that the user under which your webserver runs at actually has write permissions to the directory that you specified— and it needs to exist. It is also possible that Xdebug doesn't like spaces in paths, Although that should work just fine, I would try setting:

首先,您需要确保运行您的网络服务器的用户实际上对您指定的目录具有写权限——并且它需要存在。Xdebug 也可能不喜欢路径中的空格,虽然这应该可以正常工作,但我会尝试设置:

xdebug.profiler_output_dir = "D:/Web Development Projects/Profiler"

As the \ + char might be an escape sequence.

由于 \ + char 可能是一个转义序列。

回答by Merianos Nikos

The problem solved !

问题解决了!

The problem generated because of the log file name.

由于日志文件名而产生的问题。

I just changed it to:

我只是将其更改为:

xdebug.profiler_output_name = "callgrind.out.%t-%s"

and working properly !

并正常工作!