1

I'm currently getting some weird error messages whenever I run which php or php --ini:

Cannot load Xdebug - it was already loaded
Cannot load Xdebug - it was already loaded
Failed loading /usr/local/Cellar/php/7.2.5/pecl/20170718/xdebug.so:  dlopen(/usr/local/Cellar/php/7.2.5/pecl/20170718/xdebug.so, 9): image not found
PHP 7.3.26 (cli) (built: Jan  5 2021 14:23:37) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.26, Copyright (c) 1998-2018 Zend Technologies
    with Xdebug v3.0.4, Copyright (c) 2002-2021, by Derick Rethans
    with Zend OPcache v7.3.26, Copyright (c) 1999-2018, by Zend Technologies

I currently have 4 php versions in my /usr/local/etc/php folders: enter image description here

currently using php7.3 as my default php version. I'm planning to remove older php versions if that doesn't cause much trouble.

Can someone explain why such error is happening, and possible solutions to get rid of the error messages?

1 Answer 1

3

You are loading Xdebug multiple times, as the message says. It is possible that you are loading/using multiple ini files. You can check which ini files PHP loads by running:

php --ini

By going through them, you will see that there are multiple lines with zend_extension=xdebug.so (or variants thereof). You need to remove the duplicate ones.

Sign up to request clarification or add additional context in comments.

3 Comments

Searched xdebug.so like you've suggested, founded and removed them - works like a charm 👍🏼 Thank you for helping!
Also for Failed loading /usr/local/Cellar/php/7.2.5/pecl/20170718/xdebug.so: dlopen(/usr/local/Cellar/php/7.2.5/pecl/20170718/xdebug.so, 9): image not found PHP 7.3.26 (cli) (built: Jan 5 2021 14:23:37) ( NTS ) error, I discovered that zend_extension in xdebug.ini was pointing to incorrect version of xdebug. I've changed it to point to the correct version and the error was gone 🙂 Hope this helps for other people facing similar problem!
what was search command for Searched xdebug.so. I used php --ini and guessed xdebug file and commented out xdebug.so but not sure if this is correct or what xdebug.so does. Hopefully this worked as error went away

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.