沒想到一跑 apt upgrade
Xdebug 就突然不能用了 (╯°Д°)╯ ┻━┻
(看來是 Xdebug 就從 2 變成 3 了)

以下原本的設定檔

zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.remote_host=10.0.2.2
xdebug.remote_port=9000
xdebug.max_nesting_level=512

然後我跑 php -v 想要確認 xdebug 的版本時

vagrant@homestead:~$ php -v
Xdebug: [Config] The setting 'xdebug.remote_connect_back' has been renamed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-xdebug.remote_connect_back (See: https://xdebug.org/docs/errors#CFG-C-CHANGED)
Xdebug: [Config] The setting 'xdebug.remote_enable' has been renamed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-xdebug.remote_enable (See: https://xdebug.org/docs/errors#CFG-C-CHANGED)
Xdebug: [Config] The setting 'xdebug.remote_host' has been renamed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-xdebug.remote_host (See: https://xdebug.org/docs/errors#CFG-C-CHANGED)
Xdebug: [Config] The setting 'xdebug.remote_port' has been renamed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-xdebug.remote_port (See: https://xdebug.org/docs/errors#CFG-C-CHANGED)
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

看起來是要修改設定檔,經過一番努力(和查資料)
以下是目前使用新設定檔

zend_extension=xdebug.so
xdebug.mode=develop,debug,coverage
xdebug.discover_client_host=true
xdebug.client_host=10.0.2.2
xdebug.client_port=9000
xdebug.max_nesting_level=512
;xdebug.log=/var/www/xdebug.log

基本上還是一樣,要確定 xdebug 的設定有被載入,不然沒辦法 xdebug
(可以用 php -i 確認路徑或值)

如果要在 cli debug 可以參考這個用法

php -dxdebug.start_with_request=yes ...

參考資料

Upgrading from Xdebug 2 to 3
Xdebug 3 is here: Massive performance increase, simpler config, and PHP 8 support
Starting a debugging session from the command line