0

System Information

  • macOS 13.2.1 (22D68) (Intel Processor)
  • PHP versions installed via homebrew
  • Xdebug installed via pecl
  • Xdebug Version 3.2.0 (should be supported -> see https://xdebug.org/docs/compat)

Error Description

I am trying to get Xdebug running on PHP 8.1.

While it works fine for PHP 8.2

PHP 8.2.4 (cli) (built: Mar 16 2023 16:46:52) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.4, Copyright (c) Zend Technologies
    with Xdebug v3.2.0, Copyright (c) 2002-2022, by Derick Rethans
    with Zend OPcache v8.2.4, Copyright (c), by Zend Technologies

I get the following error message when using it with php8.1

Failed loading /usr/local/lib/php/pecl/20220829/xdebug.so:  dlopen(/usr/local/lib/php/pecl/20220829/xdebug.so, 0x0009): symbol not found in flat namespace '_zend_get_parameters_array_ex'
PHP 8.1.17 (cli) (built: Mar 16 2023 13:19:00) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.17, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.17, Copyright (c), by Zend Technologies

The following line has been added to the php.ini.

zend_extension="/usr/local/lib/php/pecl/20220829/xdebug.so"

What I have tried/done

  • Reinstalling Xdebug (pecl uninstall and then install)
  • using extension=xdebug.so (Unable to load dynamic library - which works on 8.2)
  • brew update / upgrade

Does someone have any idea what else I could try?

LazyOne
  • 158,824
  • 45
  • 388
  • 391
Dennis
  • 183
  • 1
  • 1
  • 10
  • 1
    *The following line has been added to the php.ini. "zend_extension="/usr/local/lib/php/pecl/20220829/xdebug.so""* **For PHP 8.1**? That's the problem. The `20220829` part is PHP API level .. and that number is for **PHP 8.2**, PHP 8.1 should be `20210902` (that's what I see for 8.1.16 here). You can double check that from the top of the `php -i` output. – LazyOne Mar 20 '23 at 11:45
  • I'm not a Mac user so cannot give you an exact solution .. but you need to install Xdebug for PHP 8.1 as well (separately). I'd start with configuring pecl so it uses PHP 8.1 as a base instead of PHP 8.2 when installing Xdebug. I say check these links: 1) https://stackoverflow.com/a/64391564/783119 2) https://stackoverflow.com/a/54594604/783119 – LazyOne Mar 20 '23 at 11:48

1 Answers1

1

This error means that you're trying to load Xdebug build for one PHP version (8.2) with the wrong PHP version (8.1). Each PHP version needs to have it's own xdebug.so file.

If you use pecl then you need to make sure that you use the pecl command that matches your PHP version's installation directory. The tool should be available in the same directory as the php binary, of which you will have multiples of.

Derick
  • 35,169
  • 5
  • 76
  • 99