在 CentOS7 上安装 Xdebug,出现未定义符号错误:compiler_globals

installing Xdebug on CentOS7, I get error undefined symbol: compiler_globals

我在 php.ini 上定义了 xdebug.so 路径。

但我在 phpinfo() 函数中看不到 xdebug 信息。

错误如下所示。

Failed loading /usr/lib64/php/modules/xdebug.so: /usr/lib64/php/modules/xdebug.so: undefined symbol: compiler_globals

我该如何解决这个问题?

使用 php 7.1.4 版本。

确保使用正确的 php-config.

编译 Xdebug

https://xdebug.org/download.php and then follow the instructions on https://xdebug.org/wizard.php 手动下载 xdebug.tgz

只需确保:

  1. 当您执行 phpize 步骤时 - 您为 PHP 安装使用了正确的 phpize 二进制文件。如果是自定义安装,通常是 /usr/local/php/bin/phpize
  2. 运行 ./configure 步骤也是如此。像这样提供更正 php-config 二进制文件的路径:./configure --with-php-config=/usr/local/php/bin/php-config

才可以编译扩展,将xdebug.so文件复制到扩展目录下。如果您之前至少编译过该目录,请记住先 make clean