1、下载Xdebug
2、安装
1、接下源码
tar zxvf xdebug.tar.gz
2、编译源码
cd xdebug
/usr/local/php/bin/phpize
./configure --enable-xdebug --with-php-config=/usr/local/php/bin/php-config
make
make install
安装完成后会出现:
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/
+----------------------------------------------------------------------+
| |
| INSTALLATION INSTRUCTIONS |
| ========================= |
| |
| See http://xdebug.org/install.php#configure-php for instructions |
| on how to enable Xdebug for PHP. |
| |
| Documentation is available online as well: |
| - A list of all settings: http://xdebug.org/docs-settings.php |
| - A list of all functions: http://xdebug.org/docs-functions.php |
| - Profiling instructions: http://xdebug.org/docs-profiling2.php |
| - Remote debugging: http://xdebug.org/docs-debugger.php |
| |
| |
| NOTE: Please disregard the message |
| You should add "extension=xdebug.so" to php.ini |
| that is emitted by the PECL installer. This does not work for |
| Xdebug. |
| |
+----------------------------------------------------------------------+
3、修改配置文件
sudo vim php.ini #在文件末尾添加一下内容
zend_extension = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so"
重启lnmp后通过php -v应该可以看到
PHP 7.1.7 (cli) (built: Mar 12 2018 18:11:04) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans