Skip to content
Advertisement

Xdebug error on local environment [Failed loading /usr/local/lib/php/pecl/20190902/xdebug.so:]

I want to use Xdebug on the vscode.

I tried it while reading the official documentation, but I couldn’t get it to work and got the following error.

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

Has anyone else encountered the same problem? Thank you.

Advertisement

Answer

I got this working by doing something similar to this: https://stackoverflow.com/a/48054252

I added

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

to ~/.bash_profile.

You can run source ~/.bash_profile after editing the file to get the changes to take effect.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement