我在Windows 7 x64上安装了XAMPP,安装xdebug 2.4后,一切都变慢了(10X) 在php.ini中我添加了:
[Xdebug]
zend_extension = "C:\xampp\php\ext\php_xdebug-2.4.0rc4-5.6-vc11.dll"
xdebug.remote_enable = 0
xdebug.profiler_enable = 1
xdebug.profiler_output_dir = "C:\Tmp"
xdebug.remote_host = "localhost"
答案 0 :(得分:3)
正如@terminus已经指出你将xdebug.profiler_enable
设置为true
,这意味着你的探查器将在每次执行PHP脚本时运行。
取自xdebug docs:
<强> xdebug.profiler_enable 强>
类型:整数,默认值:0
启用Xdebug的分析器,该分析器在配置文件输出目录中创建文件。 KCacheGrind可以读取这些文件以可视化您的数据。无法使用ini_set()
在脚本中设置此设置。如果您想有选择地启用分析器,请将xdebug.profiler_enable_trigger
设置为1
,而不是使用此设置。
修复主要问题停用 xdebug.profiler_enable
和启用 xdebug.profiler_enable_trigger
之后,您可以通过HTTP传递XDEBUG_PROFILE
参数来运行探查器:
curl 'http://localhost/?XDEBUG_PROFILE=1'
或者在命令行上使用xdebug.profiler_enable
选项:
$ php -d xdebug.profiler_enable=On <yourphpscrip>.php
请注意:使用X-Debug将始终减慢脚本执行时间,因此永远不要在生产环境中安装X-Debug。