简体   繁体   中英

Debugging is not working in VS code. after upgrading php version from 7.2 to 7.4

I have upgraded my PHP version from 7.2 to 7.4 and I found that debugging has stopped in all projects.

My configurations are-

zend_extension="/usr/lib/php/20190902/xdebug.so"
xdebug.remote_autostart = 1
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = 127.0.0.1
xdebug.remote_log = /tmp/xdebug_remote.log
xdebug.remote_mode = req
xdebug.remote_port = 9000

I have added the above configuration in the following files-

  • /etc/php/7.4/apache2/php.ini
  • /etc/php/7.4/apache2/conf.d/20-xdebug.ni
  • /etc/php/7.4/cli/conf.d/20-xdebug.ni
  • /etc/php/7.4/mods-available/xdebug.ini

php -v command is returning the following output-

PHP 7.4.14 (cli) (built: Jan 13 2021 08:04:06) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.14, Copyright (c), by Zend Technologies
    with Xdebug v3.0.2, Copyright (c) 2002-2021, by Derick Rethans

I have installed the Xdebug extension in VS code too-

在此处输入图像描述

phpinfo(); function is returning the following output-

在此处输入图像描述

How should I do to resolve my issue?

PHP 7.4.14 (cli) (built: Jan 13 2021 08:04:06) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.14, Copyright (c), by Zend Technologies
    with Xdebug v3.0.2, Copyright (c) 2002-2021, by Derick Rethans

If you use Xdebug with version 3 , you have to config again parameters. ( https://xdebug.org/docs/upgrade_guide#Step-Debugging ). Based on the shared documentation, I will suggest the following config:

zend_extension = "/usr/lib/php/20190902/xdebug.so"
xdebug.start_with_request = yes
xdebug.mode = debug
xdebug.client_host = 127.0.0.1
xdebug.log = /tmp/xdebug_remote.log
xdebug.client_port = 9000
xdebug.idekey = VSCODE

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