我尝试着尝试,但我无法在 PHPStorm 中使用 XDebug 为 Symfony2 获得正确的调试配置。
我已经检查并重新检查过
phpstorm xdebug 与 symfony2 项目 https://stackoverflow.com/questions/29671347/phpstorm-xdebug-with-a-symfony2-project and
如何使用 phpstorm 和 xdebug 为 symfony2 设置远程调试 https://stackoverflow.com/questions/18517083/how-to-set-up-remote-debugging-for-symfony2-with-phpstorm-and-xdebug
并遵循了jetbrains教程,但没有办法做到这一点。
这是我正在尝试调试的 Symfony2 的 REST API。到目前为止,我有一个带有 Apache2 的虚拟主机,它在 URL 中运行良好
host: sd.lo
api 的路由前缀是
/api/v1
所以访问
http://sd.lo/api/v1/clients
工作正常,我收到了一份客户名单
安装
XDebug 已正确安装,如我的 phpinfo() 中所示并使用命令
在我的 /usr/local/etc/php/5.5/conf.d/ext-xdebug.ini (正确加载)中,我有:
[xdebug]
zend_extension="/usr/local/Cellar/php55-xdebug/2.3.3/xdebug.so"
xdebug.profiler_output_dir="/tmp/xdebug/"
xdebug.profiler_enable=on
xdebug.remote_enable=on
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.idekey = PHPSTORM
并用命令
/usr/local/Cellar/php55/5.5.28/bin/php -v
PHP 5.5.28 (cli) (built: Aug 13 2015 14:02:41)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
with Xdebug v2.3.3, Copyright (c) 2002-2015, by Derick Rethans
在 PHPStorm 中
我已经在 PHPStorm 中正确设置了 PHP 解释器(我在 OSX 中安装了多个 PHP 版本。Brew 安装是我想要使用的),所以:
Path executable: /usr/local/Cellar/php55/5.5.28/bin/php
Debugger: XDebug 2.3.3 so is correct
在 PHPStorm 首选项 > PHP > 服务器中我有一个服务器
Name: Project.com
Host: sd.lo (root for my Virtual Host)
Port: 80
Debugger: XDebug
Use path mappings: UNCHECKED as I believe Symfony2 Plugin makes this for me
在调试配置中我添加了 PHP 远程调试
Name: ApiBundle
Server: Project.com (which host was sd.lo)
Ide Key: PHPSTORM
在 Chrome 中
- 我已经安装了 XDebug Helper 扩展并在 IDE Key 中选择了 PHPStorm
- 检查 cookie,我看到 cookie XDEBUG_SESSION=PHPSTORM
And then
- 我在其中一个控制器中设置了几个断点
- 我将 PHPStorm 中的电话图标切换为:开始侦听 PHP 调试连接
- 我检查我的调试选项卡中是否有:等待带有 ide key 的传入连接:PHPSTORM
可能:
如果我在 PHP 脚本中的第一行设置“运行”>“中断”并重新加载页面,脚本实际上会在 app_dev.php:13 处停止,但我的断点没有任何反应。
有谁可以照亮我吗?
Edit
这是我的 xdebug 的 phpinfo()
xdebug support enabled
Version 2.3.3
IDE Key PHPSTORM
Supported protocols Revision
DBGp - Common DeBuGger Protocol $Revision: 1.145 $
Directive Local Value Master Value
xdebug.auto_trace Off Off
xdebug.cli_color 0 0
xdebug.collect_assignments Off Off
xdebug.collect_includes On On
xdebug.collect_params 0 0
xdebug.collect_return Off Off
xdebug.collect_vars Off Off
xdebug.coverage_enable On On
xdebug.default_enable On On
xdebug.dump.COOKIE no value no value
xdebug.dump.ENV no value no value
xdebug.dump.FILES no value no value
xdebug.dump.GET no value no value
xdebug.dump.POST no value no value
xdebug.dump.REQUEST no value no value
xdebug.dump.SERVER no value no value
xdebug.dump.SESSION no value no value
xdebug.dump_globals On On
xdebug.dump_once On On
xdebug.dump_undefined Off Off
xdebug.extended_info On On
xdebug.file_link_format no value no value
xdebug.force_display_errors Off Off
xdebug.force_error_reporting 0 0
xdebug.halt_level 0 0
xdebug.idekey PHPSTORM PHPSTORM
xdebug.max_nesting_level 256 256
xdebug.max_stack_frames -1 -1
xdebug.overload_var_dump On On
xdebug.profiler_aggregate Off Off
xdebug.profiler_append Off Off
xdebug.profiler_enable On On
xdebug.profiler_enable_trigger Off Off
xdebug.profiler_enable_trigger_value no value no value
xdebug.profiler_output_dir /tmp/xdebug/ /tmp/xdebug/
xdebug.profiler_output_name cachegrind.out.%p cachegrind.out.%p
xdebug.remote_autostart Off Off
xdebug.remote_connect_back Off Off
xdebug.remote_cookie_expire_time 3600 3600
xdebug.remote_enable On On
xdebug.remote_handler dbgp dbgp
xdebug.remote_host localhost localhost
xdebug.remote_log no value no value
xdebug.remote_mode req req
xdebug.remote_port 9000 9000
xdebug.scream Off Off
xdebug.show_exception_trace Off Off
xdebug.show_local_vars Off Off
xdebug.show_mem_delta Off Off
xdebug.trace_enable_trigger Off Off
xdebug.trace_enable_trigger_value no value no value
xdebug.trace_format 0 0
xdebug.trace_options 0 0
xdebug.trace_output_dir /var/tmp/ /var/tmp/
xdebug.trace_output_name trace.%c trace.%c
xdebug.var_display_max_children 128 128
xdebug.var_display_max_data 512 512
xdebug.var_display_max_depth 3 3
但没有创建 /tmp/xdebug 文件:S