检查xdebug是否正常 [英] Check if xdebug is working

查看:193
本文介绍了检查xdebug是否正常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果不安装texteditor或IDE,是否可以测试xdebug是否正常工作,即它是否可以调试php代码?

Without installing a texteditor or an IDE, is it possible to test if xdebug is working, i.e. if it can debug php code?

xdebug出现在phpinfo()中的唯一部分如下:

The only part xdebug comes up in phpinfo() is the following:

已解析/etc/php5/apache2/conf.d/mysql.ini的其他.ini文件, /etc/php5/apache2/conf.d/mysqli.ini、/etc/php5/apache2/conf.d/pdo.ini, /etc/php5/apache2/conf.d/pdo_mysql.ini, /etc/php5/apache2/conf.d/xdebug.ini

Additional .ini files parsed /etc/php5/apache2/conf.d/mysql.ini, /etc/php5/apache2/conf.d/mysqli.ini, /etc/php5/apache2/conf.d/pdo.ini, /etc/php5/apache2/conf.d/pdo_mysql.ini, /etc/php5/apache2/conf.d/xdebug.ini

在phpinfo()中没有其他地方提到它.

It is not mentioned in the phpinfo() anywhere else.

推荐答案

如果没有实际进行调试,我想您可能不确定调试器正在工作.

Without actually doing some debugging, I guess you can't be certain that a debugger is working.

但是您可以肯定地说-我猜应该假设如果xDebug的某些方面正常工作,那么一切都会正常工作.

But you can be pretty sure -- I guess one should assume that if some aspects of xDebug are working then it would all be working.

鉴于此,您可以通过尝试以下操作来确认xDebug已安装并就位:

Given that, you can confirm that xDebug is installed and in place by trying the following:

1)phpinfo()-这将向您显示所有已加载的扩展,包括xDebug.如果它在那里,那么可以肯定它正在工作.

1) phpinfo() -- this will show you all the extensions that are loaded, including xDebug. If it is there, then it's a safe bet that it's working.

2)如果这对您还不够好,您可以尝试使用var_dump()功能. xDebug修改var_dump()的输出以包含其他信息.如果已安装,则xDebug可以正常工作.

2) If that isn't good enough for you, you can try using the var_dump() function. xDebug modifies the output of var_dump() to include additional information. If this is in place, then xDebug is working.

3)xDebug修改PHP的错误输出.如果您的程序在安装了xDebug的情况下崩溃,那么与标准的PHP崩溃输出相比,您将获得更多有关失败的信息.

3) xDebug modifies PHP's error output. If your program crashes with xDebug in place, you'll get more information about the failure than with the standard PHP crash output.

4)xDebug还向PHP添加了许多辅助函数.您可以尝试这些方法中的任何一种,以查看其是否有效.例如,函数xdebug_get_code_coverage()应该存在并返回一个数组.如果已安装,则将安装xDebug.如果不是,则不是.

4) xDebug also adds a number of helper functions to PHP. You could try any of these to see if it's working. For example, the function xdebug_get_code_coverage() should exist and return an array. If it does, then xDebug is installed. If not, it isn't.

这篇关于检查xdebug是否正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆