xdebug怎样在php中配置,php使用xdebug的配置方法

在获取xdebug源码,本文示例版本为2.4.1,其它版本可在官网下载。

https://xdebug.org/announcements

关于xdebug与PHP的版本对应关系 ,可以使用https://xdebug.org/wizard页面查询;

2.解压源码文件,并进入目录

tar -xzvf xdebug-2.4.1.tgz

cd xdebug-2.4.1

3.检测PHP环境,在xdebug-2.4.1目录中执行phpize,phpize是用来扩展php扩展模块的,通过phpize可以建立php的扩展模块,而xdebug-2.4.1就是一个PHP扩展模块;

执行成功后可以看到当前的php api版本,扩展api版本等。

可以通过find查找phpize所在目录:

[root@test xdebug-2.4.1]# find / -name phpize

/usr/bin/phpize

[root@test xdebug-2.4.1]#

[root@test xdebug-2.4.1]# /usr/bin/phpize

Configuring for:

PHP Api Version: 20090626

Zend Module Api No: 20090626

Zend Extension Api No: 220090626

[root@test xdebug-2.4.1]#

执行完成后,xdebug-2.4.1目录中会产生configure文件,执行configure后,再make

./configure --enable-xdebug

make && make install

5.启用PHP扩展,编辑php.ini文件,加入xdebug扩展。

vim /etc/php.ini

加入以下扩展配置

extension=/usr/lib64/php/modules/xdebug.so

重启Apache服务后输出phpinfo信息,如果能找到xdebug,就说明扩展生效了。

6.php.ini配置,在php.ini中添加如下配置信息

[Xdebug]

zend_extension ="/usr/lib64/php/modules/xdebug.so"

xdebug.profiler_enable=on

xdebug.trace_output_dir="/usr/local/php/xdebug/"

xdebug.profiler_output_dir="/usr/local/php/xdebug/"

xdebug.profiler_output_name = "cachegrind.out.%t.%p"

xdebug.remote_enable=on

xdebug.show_local_vars=1

xdebug.idekey = PHPSTROM

xdebug.remote_handler = "dbgp"

xdebug.remote_mode = "req"

xdebug.remote_host = 远程调试PC的IP地址

xdebug.remote_port = 9000

xdebug.remote_autostart = off

7.PhpStorm配置

407ec546c0a9

配置调试服务器1

407ec546c0a9

服务器目录及本地目录

407ec546c0a9

PhpStorm Debug设置1

407ec546c0a9

PhpStorm Debug设置2

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值