首页 > 代码库 > Ubuntu-16.04安装Xdebug-2.2.5及相关介绍

Ubuntu-16.04安装Xdebug-2.2.5及相关介绍

Xdebug是一个开放源代码的PHP程序调试器(即一个Debug工具),可以用来跟踪,调试和分析PHP程序的运行状况。在日常开发中,我们会使用如 print_r() var_dump()等函数来进行调试,但毕竟Xdebug更加的专业,简单介绍下在Ubuntu-14.04下Xdebug-2.2.5的安装。

//闻海南PHP博客 http://blog.phpha.comphpha@asus:~$ wget http://www.xdebug.org/files/xdebug-2.2.5.tgzphpha@asus:~$ tar -zxf xdebug-2.2.5.tgzphpha@asus:~$ cd xdebug-2.2.5/phpha@asus:~/xdebug-2.2.5$ /usr/local/php/bin/phpizeConfiguring for:PHP Api Version:         20121113Zend Module Api No:      20121212Zend Extension Api No:   220121212phpha@asus:~/xdebug-2.2.5$ ./configure --enable-xdebug --with-php-config=/usr/local/php/bin/php-configphpha@asus:~/xdebug-2.2.5$ sudo makephpha@asus:~/xdebug-2.2.5$ sudo make install//闻海南PHP博客 http://blog.phpha.comInstalling shared extensions:     /usr/local/php/lib/php/extensions/no-debug-zts-20121212/  +----------------------------------------------------------------------+  |                                                                      |  |   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.                                                            |  |                                                                      |  +----------------------------------------------------------------------+//天涯PHP博客 http://blog.phpha.com

以上已经成功安装了Xdebug扩展,接下来还需要我们对php.ini配置文件就行一些修改。

//闻海南PHP博客 http://blog.phpha.comphpha@asus:~$ sudo vim /usr/local/php/etc/php.ini//添加以下配置选项,更多配置选项请自己借助查看官方说明[Xdebug]zend_extension = /usr/local/php/lib/php/extensions/no-debug-zts-20121212/xdebug.soxdebug.auto_trace = onxdebug.default_enable = onxdebug.auto_profile = onxdebug.collect_params = onxdebug.collect_return = onxdebug.profiler_enable = onxdebug.remote_host = localhostxdebug.remote_port = 9000xdebug.remote_handler = dbgpxdebug.trace_output_dir = "/usr/local/php/xdebug/"xdebug.profiler_output_dir = "/usr/local/php/xdebug/"//闻海南PHP博客 http://blog.phpha.com//重启Apachephpha@asus:~$ sudo service apache restart

搞定安装完毕,开心ING,如果解决你的问题,就评论下呗

Ubuntu-16.04安装Xdebug-2.2.5及相关介绍