这是/etc/php/7.2/cli/conf.d/20-xdebug.ini
内容:
zend_extension=xdebug.so
xdebug.remote_enable=on
xdebug.remote_autostart=off
这是我通过运行php
得到的错误:
PHP Warning: Failed loading Zend extension 'xdebug.so' (tried: /usr/lib/php/20170718/xdebug.so (libc.musl-x86_64.so.1: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/xdebug.so.so (/usr/lib/php/20170718/xdebug.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
但是/usr/lib/php/20170718/xdebug.so
存在并且具有读取权限:
# ls -l /usr/lib/php/20170718/xdebug.so
-rw-r--r--. 1 root root 2078128 Jan 16 11:15 /usr/lib/php/20170718/xdebug.so
将扩展路径更改为完整路径也无济于事。
可能是什么原因?
请参考以下链接,因为我认为它可以像我一样解决您的问题Installing Xdebug
在xdebug.ini
文件中尝试此内容
zend_extension=xdebug.so
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.show_error_trace = 1 <--- you can skip this
xdebug.remote_autostart = 0
似乎出厂的xdebug模块已损坏,并通过apt
安装它解决了问题:
apt install php-xdebug
在通过apt
安装源代码之前,我也尝试并编译了很多次源代码,但是每次都遇到相同的错误。但是确切原因仍然未知。