php 中xdebug安装

实验环境CentOS


phpinfo()

显示

PHP Version 5.3.3

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

xdebug-2.2.5






linux下解压xdebug包。

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


我的机子,运行phpize出错

[root@localhost xdebug-2.2.5]# phpize
-bash: phpize: command not found



安装phpize

phpize是属于php-devel的内容

yum install php-devel -y
[root@localhost xdebug-2.2.5]# phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626


2、在运行

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

好了,编译结束了。

[root@localhost xdebug-2.2.5]# ll modules/
total 660
-rw-r--r--. 1 root root    923 Oct 17 06:19 xdebug.la
-rwxr-xr-x. 1 root root 668885 Oct 17 06:19 xdebug.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 = on
xdebug.default_enable = on
xdebug.trace_output_dir="/tmp/xdebug"
xdebug.trace_output_name = trace.%c.%p
xdebug.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


php 中xdebug安装



或者

[root@localhost etc]# php -m |grep debug
xdebug
Xdebug