简体   繁体   中英

Xdebug configuration with Vim

I am on Ubuntu 20.04 using php 7.4.18 and apache and has its document root at /var/www/html . This is my php --version

PHP 7.4.18 (cli) (built: May  3 2021 11:27:06) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.18, Copyright (c), by Zend Technologies
    with Xdebug v3.0.3, Copyright (c) 2002-2021, by Derick Rethans

my xdebug.ini

zend_extension=xdebug.so
xdebug.remote_autostart = 1
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = 127.0.0.1
xdebug.remote_mode = req
xdebug.remote_port = 9000

My.vimrc

let g:vdebug_options = {"port": 9000, "break-on-open": 0, }

I have a wordpress installation in /var/www/html/wordress and when i try to debug in vim it is showing "Vdebug will wait for a connection" even if i access "localhost/wordpress" with ?XDEBUG_SESSION_START=1 ( I tried installing Xdebug Helper for chrome ) it is not connecting.

What other things i have tried

  1. I added the xdebug.ini code to php.ini but couldn't get it connected.
  2. Added "path_maps": {'/':'/var/www/html'} to vdebut_option in vimrc.

Please help and let me know what am i doing wrong?

This is my xdebug_info() screenshot在此处输入图像描述

You're setting Xdebug 2 settings, but running Xdebug 3:

xdebug.remote_autostart = 1
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = 127.0.0.1
xdebug.remote_mode = req
xdebug.remote_port = 9000

You need to convert these to Xdebug 3 settings, as per the upgrade guide . The xdebug_info() output that you shared has links to the "Docs" (most right column) too, and it shows that "Step Debugger" is not enabled.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM