如何调试PHP应用程序? [英] How to debug a PHP application?

查看:119
本文介绍了如何调试PHP应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪些是调试PHP应用程序的最佳方法,因为我们可以使用Visual Studio调试ASP.NET应用程序?

解决方案

我正在使用IDE Eclipse PDT ,它可以使用PHP扩展名 Xdebug 提供调试功能,与Visual Studio相同(有点不太强大,也许),这样可以执行以下操作:



  • 一步一步

  • 进入/退出函数/方法

  • 查看变量的内容

  • 有一个堆栈跟踪显示你在哪里



真的很好调试大程序 - 特别是没有写的程序,了解他们的工作原理(或不要^^)



也可以使用扩展名zend debugger;但是我从来没有尝试过这个。





即使不使用像PDT提供的调试器,Xdebug也是一个很好的扩展在开发服务器上:当有错误/异常时,它提供了很好的堆栈跟踪,它允许您获得漂亮的 var_dump 的输出,...



它也可以用于获取分析数据,您可以使用 KCacheGrind WinCacheGrind Webgrind



但请注意,它的表现不好,所以它绝对不应该安装在生产服务器上!





您还可以查看这些问题,你的:




Which is the best way to debug an PHP application as we can debug ASP.NET application with Visual Studio ?

解决方案

I'm using the IDE Eclipse PDT, which can use the PHP extension Xdebug to provide debugging functionnalities, kind of the same way as Visual Studio (a bit less powerful, maybe), which gives you the ability to do things like :

  • step by step
  • step in / out of functions / methods
  • see the content of variables
  • have a stack trace showing where you are

That's really nice to debug big programs -- especially ones you didn't write, to understand how they work (or don't ^^ )

It can also use the extension "zend debugger" ; but I've never tried this one.


Even without using a debugger like the one provided by PDT, Xdebug is a nice extension to have on a development server : it gives nice stack traces when there's an error/exception, it allows you to get nice-looking var_dump's output, ...

It can also be used to get profiling data, which you can visualize with tools like KCacheGrind, WinCacheGrind, or Webgrind.

But note it is hurting performance badly, so it definitly should not be installed on a production server !


You can also have look at these questions that are close to yours :

这篇关于如何调试PHP应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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