centos7.1 php+xdebug+phpstorm2020安装 常见报错

一、安装xdebug  

官网安装教程:https://xdebug.org/docs/install

pecl install xdebug
可固定版本安装
pecl install xdebug-2.9.5

安装时若出现以下错误

Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

ERROR: `phpize' failed

运行下面代码

yum install autoconf

成功后再重新安装xdebug,出现下面代码表示安装成功

install ok: channel://pecl.php.net/xdebug-2.9.5
configuration option "php_ini" is not set to php.ini location
You should add "zend_extension=/usr/local/php74/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so" to php.ini

修改php.ini文件,再最后添加下面代码

remote_port要与phpstrom中port配置相同
remote_host 用虚拟机或其他服务器设置为本机ip, 都为同一系统的可设为127.0.0.1
[xdebug]
zend_extension=/usr/local/php74/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so
xdebug.enable=1
xdebug.remote_enable=1
;如果开启此,将忽略下面的 xdebug.remote_host 的参数
;xdebug.remote_connect_back=1
;自动启动,无需XDEBUG_SESSION_START=1
xdebug.remote_autostart=1
;宿主机IP
xdebug.remote_host=192.168.159.162
xdebug.remote_port=19001
xdebug.remote_handler=dbgp
xdebug.remote_log=/var/tmp/xdebug.log
xdebug.idekey=PHPSTORM

重新运行php-fpm,即可安装成功。

可用 php -m查看PHP扩展中是否有xdebug

xmlrpc
xmlwriter
zlib

[Zend Modules]
Xdebug

二、phpstorm设置

见下文转载链接

 https://blog.csdn.net/WhitEKinGdom08/article/details/101151079

原文地址:https://www.cnblogs.com/YueJinSanQian/p/12884043.html