安装php调试工具 xdebug

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

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

php -version

PHP 7.2.4 (cli) (built: Apr 10 2018 10:59:05) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

* 下载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

猜你喜欢

转载自blog.csdn.net/fareast_mzh/article/details/81586731
今日推荐