我尝试在我的计算机上安装 PHP 的 Xdebug 扩展(Linux Mint,PHP 版本 7.3.6)。
我已按照说明表 Xdebug wizard page .完成后,我在终端中运行了以下命令:
php --version
它向我显示了我的 PHP 版本,但也显示了以下警告:
Failed loading /usr/lib/php/20180731/xdebug.so: /usr/lib/php/20180731/xdebug.so: undefined symbol: gc_globals
调用 phpinfo() 时,Xdebug 也未列为已启用的扩展。你能帮忙吗,我的 Xdebug 安装哪里有问题?
我已经使用向导页面中的以下步骤安装了 Xdebug:
• 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
最佳答案
有这个问题,在我的情况下是因为安装了不同版本的 PHP。
CLI 的 PHP 版本为 7.2,而 FPM 的版本为 7.3。因此,在 7.3 服务器上使用了 7.2 的 xdebug 安装版本。
要检查 CLI 版本,请使用 php -v
在终端。
要检查 FPM 版本,请使用 phpinfo();
页面或运行 php-fpm7.2 -v
在终端中(由于二进制名称中的版本,这有点毫无意义)。
我的解决方案是删除与 php 7.3 相关的包。
但是您可以通过其他方式解决问题,例如安装正确版本的 xdebug 或降级 php-fpm。
关于php - 无法加载 xdebug.so : undefined symbol: gc_globals,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56738956/