Assumption
- Ubuntu 20.04.2 LTS
- PHP 7.4.3 (see installation on Ubuntu https://linuxize.com/post/how-to-install-php-on-ubuntu-20-04/)
- Xdebug v2.9.2 (see installation on Ubuntu https://xdebug.org/docs/install#linux)
- Use Visual studio code as IDE
- Already Installed php debug, the Visual studio code extension (see install guide https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-debug)
- (optional) Already install vim (see installation guide https://www.vim.org/download.php#unix)
First thing first, navigate to
cd /etc/php/7.4/mods-available
Then edit the file xdebug.ini with sudo
sudo vim /etc/php/7.4/mods-available/xdebug.ini
Then paste these line to the file /etc/php/7.4/mods-available/xdebug.ini
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
Done !!!