# 查看php版本
$ php -version
PHP 7.0.7 (cli) (built: May 5 2017 01:19:55) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
with Xdebug v2.5.3, Copyright (c) 2002-2017, by Derick Rethans
在xdebug官网 https://xdebug.org/ 寻找与php匹配的版本。
# 下载xdebug
$ mkdir -p /opt/xdebug && cd /opt/xdebug
# 下载xdebug
$ wget https://xdebug.org/files/xdebug-2.5.5.tgz
# 解压文件
$ tar -zxvf xdebug-2.5.5.tgz
使用php编译安装xdebug
$ cd xdebug-2.5.5
$ /usr/local/php/bin/phpize
$ ./configure --with-php-config=/usr/local/php/bin/php-config
$ make && make install
$ make test
查看xdebug配置
$ sudo vim /usr/local/php/etc/php.ini
# 重启LNMP服务
$ sudo lnmp restart
# 查看
$ php -m | grep xdebug
使用 phpinfo()
查看xdebug配置