实验环境CentOS


phpinfo()

显示

PHP Version 5.3.3

去官网http://www.xdebug.org/对应下载

xdebug-2.2.5






linux下解压xdebug包。

1、进入xdebug,在这个目录下先运行php目录下面的bin/phpize;


我的机子,运行phpize出错

[root@localhostxdebug-2.2.5]#phpize-bash:phpize:commandnotfound



安装phpize

phpize是属于php-devel的内容

yuminstallphp-devel-y[root@localhostxdebug-2.2.5]#phpizeConfiguringfor:PHPApiVersion:20090626ZendModuleApiNo:20090626ZendExtensionApiNo:220090626


2、在运行

[root@localhostxdebug-2.2.5]#./configure--enable-xdebug[root@localhostxdebug-2.2.5]#make

好了,编译结束了。

[root@localhostxdebug-2.2.5]#llmodules/total660-rw-r--r--.1rootroot923Oct1706:19xdebug.la-rwxr-xr-x.1rootroot668885Oct1706:19xdebug.so



这是时候会在xdebug的目录下生成 目录modules,目录下有xdebug.so文件,把xdebug.so复制到你想放的目录。


3. 编辑php.ini文件


再php的配置文件后面加上

zend_extension = "/路径/xdebug.so"

如下:

zend_extension="/home/samba/test/xdebug-2.2.5/modules/xdebug.so"xdebug.profiler_enable=onxdebug.default_enable=onxdebug.trace_output_dir="/tmp/xdebug"xdebug.trace_output_name=trace.%c.%pxdebug.profiler_output_dir="/tmp/xdebug"xdebug.profiler_output_name="cachegrind.out.%s"



[root@localhost xdebug-2.2.5]#service httpd restart


phpinfo()

显示


This program makes use of the Zend Scripting Language Engine:

Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans




或者

[root@localhostetc]#php-m|grepdebugxdebugXdebug