Xdebug
是一个开源的PHP程序调试器;能够帮助你跟踪、调试和分析PHP程序,也能够帮你了解PHP底层的实现原理和结构。php
去官网下载 下载地址。html
Warning:
PHP版本不一样对应的xdebug扩展也不同,若是不知道选哪一个能够看这里。
注意下载页面有个custom installation instructions.
点击这个会跳转到一个新的页面
按照上面给的提示有两种方法能够知道当前适合哪一种xdebug扩展(这里使用第二种方法):segmentfault
- 输入框里贴入
<?php echo phpinfo(); ?>
html代码- 使用
php -i
方法。打开
cmd
输入php -i
命令回车。(这里面须要注意php是否加入系统环境变量,若是没有须要进入php安装目录)
点击按钮Analyse my phpinfo() output
,而后会推荐你下载某个版本的xdebug扩展,这个功能能够帮咱们省了不少时间。windows
下载好将 php_xdebug-2.7.2-7.2-vc15-x86_64.dll
扩展放在 ext
目录下。
而后打开 php.ini
添加下面内容服务器
; XDEBUG Extension [xdebug] zend_extension ="D:/wamp64/bin/php/php5.6.40/zend_ext/php_xdebug-2.5.5-5.6-vc11-x86_64.dll" xdebug.idekey="PHPSTORM" xdebug.remote_enable = on xdebug.profiler_enable = off xdebug.profiler_enable_trigger = off xdebug.profiler_output_name = cachegrind.out.%t.%p xdebug.profiler_output_dir ="D:/wamp64/tmp" xdebug.show_local_vars=0 xdebug.remote_handler = dbgp ; 设置xdebug的端口为9001, 要和编辑器设置的一致哦 xdebug.remote_port = "9001"
source
压缩文件,下载好后将压缩包上传到服务器上wget http://www.xdebug.org/files/xdebug-2.7.2.tgz
命令,获取xdebug扩展压缩包tar zxvf xdebug-2.7.2.tgz
,解压后进入文件夹 xdebug-2.7.2
,编辑器
phpize
建立configure 文件,若是提示没有这个文件,能够使用 find / -name phpize
找到这个文件的绝对路径。./configure
,若是须要手动指定PHP的配置路径,运行./configure --enable-xdebug --with-php-config=/usr/local/php/bin/php-config
make && make install
修改配置文件 php.ini
添加ide
[xdebug] ;注意路径要写对 zend_extension="/path/php/ext/xdebug.so"
systemctl restart php-fpm
使用 echo phpinfo()
输出能够看到php安装xdebug已经成功;php-fpm