* 浏览器打开xdebug官网 https://xdebug.org/download.php

  如果是windows系统 下载对应的Windows binaries, 注意版本号

php -version

PHP 7.2.8 (cli) (built: Jul 18 2018 10:18:27) ( ZTS MSVC15 (Visual C++ 2017) x86 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Xdebug v2.7.0alpha1, Copyright (c) 2002-2018, by Derick Rethans

http://localhost/dashboard/phpinfo.php

安装php调试工具 xdebug_ide

这种情况下要下载:

https://xdebug.org/files/php_xdebug-2.7.0alpha1-7.2-vc15.dll

copy %userprofile%\Downloads\php_xdebug-2.7.0alpha1-7.2-vc15.dll  D:\opt\xampp\php\ext
mkdir D:\opt\xampp\xdebug

在php.ini文件中添加Xdebug的内容

----------------------------------------------------------------------------------------------------------------

[Xdebug]
zend_extension = "D:/opt/xampp/php/ext/php_xdebug-2.7.0alpha1-7.2-vc15.dll"
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.profiler_enable=1
xdebug.profiler_output_dir="D:/opt/xampp/xdebug"
xdebug.idekey="PHPSTORM"

----------------------------------------------------------------------------------------------------------------

重启apache, 再查看phpinfo http://localhost/dashboard/phpinfo.php

 

* Mac/Linux 下载xdebug代码

git clone git://github.com/xdebug/xdebug.git
cd xdebug
./configure
make
sudo make install

Libraries have been installed in:
   /Users/Mch/Code/tools/xdebug/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable
     during execution

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Installing shared extensions:     /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20170718/

  +----------------------------------------------------------------------+
  |                                                                      |
  |   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.                                                            |
  |                                                                      |
  +----------------------------------------------------------------------+

* 查看安装好的扩展

ls /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20170718/

opcache.a    opcache.so   pdo_dblib.a  pdo_dblib.so pgsql.a      pgsql.so     redis.so     xdebug.so

* 编辑php.ini文件

emacs /Applications/XAMPP/etc/php.ini

添加这几行

[Xdebug]
zend_extension = "/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_port=9200
xdebug.profiler_enable=1
xdebug.profiler_output_dir="/Applications/XAMPP/xdebug"
xdebug.idekey = "PHPSTORM"

 

* 查看phpinfo

echo "<?php echo phpinfo(); ?>" > phpinfo.php
php -S 0.0.0.0:9000

浏览器访问 http://localhost:9000/phpinfo.php 看到xdebug support