laravel - 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?
Answer
Solution:
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
Source