Reputation: 101
I'm trying to debug a Laravel project in my MacOs but it's not working (Laravel + VScode + Xdebug).
phpinfo
php.ini
;zend_extension="xdebug.so"
[PHP]
zend_extension = /usr/local/lib/php/pecl/20190902/xdebug.so
xdebug.remote_enable = 1
xdebug.remote_connect_back=1
xdebug.remote_port = 8000
xdebug.scream=0
launch.json
{
// 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": 8000,
"log": true
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 8000
}
]
}
VScode editor VScode editor screenshot
Debug console of VScode
connection closed
connection closed
After run php artisan serve on terminal of VScode. The laravel project was running but the Xdebug was not trigged as i expected. I don't know what is the problem. I've spent for several time but still could not be solved. Anyone who had experienced with VScode + Xdebug please help me.
Thank you for reading my post.
Upvotes: 1
Views: 2508
Reputation: 101
It's working now. After i changed the Port of 'launch.json' to 9000 and updated the 'php.ini' to " [xdebug] xdebug.remote_enable=1 xdebug.remote_autostart=1 " removed all old content. Finally, run the command "sudo apachectl restart" . Now i can debug my laravel project. Thank you @LazyOne for supporting
Upvotes: 0