首页 > 解决方案 > 本地环境中的 Xdebug 错误 [加载 /usr/local/lib/php/pecl/20190902/xdebug.so 失败:]

问题描述

我想在 vscode 上使用 Xdebug。

我在阅读官方文档时尝试了它,但我无法让它工作并得到以下错误。

Failed loading /usr/local/lib/php/pecl/20190902/xdebug.so:  dlopen(/usr/local/lib/php/pecl/20190902/xdebug.so, 9): no suitable image found.  Did find:
        /usr/local/lib/php/pecl/20190902/xdebug.so: stat() failed with errno=20

php --ini

Failed loading /usr/local/lib/php/pecl/20190902/xdebug.so:  dlopen(/usr/local/lib/php/pecl/20190902/xdebug.so, 9): no suitable image found.  Did find:
    /usr/local/lib/php/pecl/20190902/xdebug.so: stat() failed with errno=20
Configuration File (php.ini) Path: /usr/local/etc/php/7.4
Loaded Configuration File:         /usr/local/etc/php/7.4/php.ini
Scan for additional .ini files in: /usr/local/etc/php/7.4/conf.d
Additional .ini files parsed:      /usr/local/etc/php/7.4/conf.d/ext-opcache.ini

有没有其他人遇到过同样的问题?谢谢你。

标签: phplaravelvisual-studio-codexdebug

解决方案


我通过做类似的事情来完成这项工作:https ://stackoverflow.com/a/48054252

我添加了

export PATH="$(brew --prefix php)/bin:$PATH"

~/.bash_profile.

您可以source ~/.bash_profile在编辑文件后运行以使更改生效。


推荐阅读