Vagrant with xdebug

Hello All,

Did anyone try to run xdeubg from macOS with ubuntu vagrant and vscode?

I tried to configure this many times and it not working 😭

Update :
I found the solution
change the vagrant timezone to be same as host timezone
server xdebug configuration .ini file changed to be :
xdebug.idekey=VSCODE
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.remote_autorestart = 1
xdebug.client_port=9003
xdebug.max_nesting_level = 512
xdebug.log_level=10
xdebug.connect_timeout_ms=600
xdebug.log=/var/log/xdebug/xdebug33.log
xdebug.show_error_trace=true
note that this configuration related to xdebug V3

in vagrant file , add port 80 as forwrded_port to be like this

Vagrant.configure(2) do |config|
config.vm.box_url = "file:///Users/toqaabbas/projects/theqar_vagrant/ubuntu16_php7.4_vagrantbox"
config.vm.box = "baazbox"
config.vm.provider "virtualbox" do |v|
v.memory = 5120
v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate//var/www","1"]
v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/var/www","1"]
end

#config.vm.box = "ubuntu/xenial64"
config.vm.network "private_network", ip: "192.168.33.33"
config.vm.network "forwarded_port", guest: 80, host: 80
config.vm.provision :shell, :inline => "sudo rm /etc/localtime && sudo ln -s /usr/share/zoneinfo/Asia/Amman /etc/localtime", run: "always"

config.vm.synced_folder "../", "/var/www"

config.vm.provision "fix-no-tty", type: "shell" do |s|
s.privileged = false
s.inline = "sudo sed -i '/tty/!s/mesg n/tty -s \&\& mesg n/' /root/.profile"
end

config.vm.provision "file", source: "root", destination: "~"
config.vm.provision :shell, path: "setup_vagrant.sh"
config.vm.box_check_update = false
end

and then run "vagrant reload" to re-build vagrant again

finally change lanuch.json to be :
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": {
"/var/www" : "/Users/myusername/projects"
},
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9003
}
]
}
the most important part was the correct location of "pathMappings"

24