VScode中的Xdebug被MacOs中的 "artisan serve "弄得无法使用。

问题描述 投票:0回答:1

我想在我的MacOs中调试一个Laravel项目,但它没有工作(Laravel + VScode + Xdebug).

phpinfo

phpinfo1

phpinfo2

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 

启动.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编辑器VScode编辑器截图

VScode的调试控制台

connection closed
connection closed

运行后 php artisan serve 在VScode的终端上,Laravel项目正在运行,但Xdebug没有像我想象的那样被触发。laravel项目在运行,但Xdebug没有像我预期的那样被触发。我不知道问题出在哪里。我已经花了好几个时间,但仍然无法解决。有谁有VScode+Xdebug的经验,请帮帮我。

谢谢你看我的帖子。

php laravel visual-studio-code xdebug
1个回答
0
投票

现在可以用了。我把'launch.json'的端口改成9000,并把'php.ini'更新为"[xdebug] xdebug.remote_enable=1 xdebug.remote_autostart=1",删除了所有旧内容。最后,运行命令 "sudo apachectl restart"。现在我可以调试我的laravel项目了。感谢@LazyOne的支持

© www.soinside.com 2019 - 2024. All rights reserved.