pab*_*ara 5 php apache vim xdebug apache2
如何配置Xdebug以使其适用于Vim的Vdebug -PHP调试器?
我正在尝试安装Vdebug以在Vim中调试PHP.不幸的是,当我按F5时,此消息会在几秒钟后出现
Waiting for a connection (Ctrl-C to cancel, this message will self-destruct in
20 seconds...)
No connection was made
Run Code Online (Sandbox Code Playgroud)
我该怎么办?
我解决了它,现在 Vdebug 可以工作了。
在 PHP 中启用 xdebug 编辑 php.ini 文件并在“模块设置”部分下添加以下内容:
;;;;;;;;;;;;;;;;;;; ; 模块设置;;;;;;;;;;;;;;;;;;;;
zend_extension=/path/to/my/xdebug.so
[调试]
; 远程设置
xdebug.remote_autostart=关闭
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
; 常规 xdebug.auto_trace=off
xdebug.collect_includes=on
xdebug.collect_params=关闭
xdebug.collect_return=关闭
xdebug.default_enable=on
xdebug.extended_info=1
xdebug.manual_url= http://www.php.net
xdebug.show_local_vars=0
xdebug.show_mem_delta=0
xdebug.max_nesting_level=100
;xdebug.idekey=
; 跟踪选项
xdebug.trace_format=0
xdebug.trace_output_dir=/tmp
xdebug.trace_options=0
xdebug.trace_output_name=crc32
; 分析
xdebug.profiler_append=0
xdebug.profiler_enable=0
xdebug.profiler_enable_trigger=0
xdebug.profiler_output_dir=/tmp
xdebug.profiler_output_name=crc32
试试看
现在一切都应该准备好了。重新启动 apache 并运行 phpinfo() 查看是否出现任何 xdebug 信息。如果没有,那么 apache error_log + google 就是你的朋友。
否则,您就可以在 vim 中运行调试器了。
在 VIM 中打开可从本地主机访问的 PHP 脚本 在 Web 浏览器中打开相同的 PHP 脚本 将 ?XDEBUG_SESSION_START=1 添加到 URL 末尾 在 VIM 中,按 F5。您应该在 VIM 底部看到类似“等待端口 9000 上的新连接 10 秒...”的信息。在接下来的 10 秒内,刷新浏览器页面并在 URL 末尾添加“?XDEBUG_SESSION_START=1”。返回 VIM,您就可以进入调试器了。不要忘记:要在 VIM 中的窗口之间切换,请按 CTRL-ww。
来源 - 它适用于 Ubuntu,尽管它指的是另一个 Linux 发行版 -
希望这可以帮助。