For installing the XDebug in ubuntu and use it from VScode follow these steps
1.Step one
Run this command
sudo apt install php-xdebug
2.Step two
Run this command
sudo nano /etc/php/7.4/mods-available/xdebug.ini
Then go to the end of the file and add these lines
[xdebug]
zend_extension=/usr/lib/php/20190902/xdebug.so
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_port = 9000
For finding the path of the xdebug (/usr/lib/php/20190902/xdebug.so)
you can run this command
locate xdebug.so
3.Step three
Open the configuration file of Xdebug by clicking ‘Add Configuration…’ from the menu Run and set the necessary configuration according to the xdebug.ini file.
It will become sth like this
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000,
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000
}
]
}
Top comments (2)
thanks alot!
De rien! :-)