Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed loading xdebug.so: undefined symbol: gc_globals

I have tried to install Xdebug extension for PHP on my computer (Linux Mint, PHP version 7.3.6).

I have followed instructions form Xdebug wizard page. When I finished I had run following command in terminal:

php --version

It shows me version of my PHP but also a following warning:

Failed loading /usr/lib/php/20180731/xdebug.so: /usr/lib/php/20180731/xdebug.so: undefined symbol: gc_globals

Xdebug is not listed as enabled extension when calling phpinfo() either. Could you please help, where can be problem with my Xdebug installation?

I have installed Xdebug using following steps from the wizard page:

• Download xdebug-2.7.2.tgz
• Install the pre-requisites for compiling PHP extensions.
• On your Ubuntu system, install them with: apt-get install php-dev autoconf automake
• Unpack the downloaded file with tar -xvzf xdebug-2.7.2.tgz
• Run: cd xdebug-2.7.2
• Run: phpize (See the FAQ if you don't have phpize).
• 
• As part of its output it should show:
• 
• Configuring for:
• ...
• Zend Module Api No:      20180731
• Zend Extension Api No:   320180731
• If it does not, you are using the wrong phpize. Please follow this FAQ entry and skip the next step.
• 
• Run: ./configure
• Run: make
• Run: cp modules/xdebug.so /usr/lib/php/20180731
• Edit /etc/php/7.3/cli/php.ini and add the line
• zend_extension = /usr/lib/php/20180731/xdebug.so
like image 575
tomas.teicher Avatar asked Jun 24 '19 14:06

tomas.teicher


2 Answers

Had this problem and in my case it happened because of different versions of PHP installed. CLI had PHP version 7.2 and FPM had version 7.3. So during xdebug installation version from 7.2 was used on 7.3 server.

To check CLI version use php -v in the terminal.

To check FPM version use phpinfo(); page or run php-fpm7.2 -v in terminal (which is kinda pointless because of the version in the binary name).

The solution in my case was to remove packages related to php 7.3.

But you can fix the problem in other ways like installing the correct version of xdebug or downgrading php-fpm.

like image 72
Kremnev Sergey Avatar answered Oct 08 '22 21:10

Kremnev Sergey


I came across the same error as you. The wizard wasn't providing me with the correct version. So instead I ran

pecl install xdebug

And then after it had completed, it said

You should add "zend_extension=/usr/lib/php/20180731/xdebug.so" to php.ini

So I did that and running

php -v

the error is gone and xdebug is installed.

If you problems with the pecl command make sure you have

apt-get install php7.3-xml

If you're not sure which .ini file to append, run

php -i | grep php.ini
like image 24
Michael Millar Avatar answered Oct 08 '22 20:10

Michael Millar