如何调试用PHP编写的Web服务? [英] How to debug a web service written in PHP?

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

问题描述

我在这里有一个很好的问题:)

I've got a nice question here :)

我需要调试用PHP编写的Web服务。它的客户端是用C#编写的。

经过几天的搜索,我意识到这不是一件容易的事。至少似乎没有人知道正确的解决方案。

I need to debug my web service written in PHP. Its client is written in C#.
After a couple of days of searching I realized this is not an easy task. At least it seems nobody knows the right solution.

实际上出了什么问题?

我们有2个流行的PHP调试库:PHP Debugger来自NuSphere和XDebug扩展。

问题是它们都是通过URL查询字符串或cookie的控制。例如,要使用PHP Debugger启用调试,您需要在URL中添加?DBGSESSID = xxx参数或具有DBGSESSID cookie。

但是,当从外部客户端调用Web服务时,客户端不会没有cookie,并且不添加DBGSESSID url参数。那么在这种情况下我们该如何调试?

What is the problem in, actually?
We have 2 popular PHP debugging libraries : PHP Debugger from NuSphere and XDebug extension.
The problem is they both are controlled from URL query string or with the help of cookies. For example, to enable debugging with PHP Debugger you need to add ?DBGSESSID=xxx parameter to your URL or to have DBGSESSID cookie.
But when your web service is called from the external client, the client doesn't have a cookie and doesn't add DBGSESSID url parameter. So how can we debug in this situation?

PS。我不想写入日志文件,请参阅请求和响应标题/数据或类似内容。我需要常规的逐步调试和断点。

有人吗?

推荐答案

好,我是对自己说。
如果我们使用PHPEd& DBG,那么我们可以使用魔术函数DebugBreak()。

Well, I am answering to myself. If we use PHPEd & DBG, then we can use the magic function DebugBreak().

请确保PHPEd& PHP DBG侦听器正在运行,编写

Make sure PHPEd & PHP DBG Listenere are running, write

DebugBreak('1@127.0.0.1');

在您的werbservice代码中的任何地方,打电话给客户,然后瞧! -您在调试模式下处于PHPEd上!

anywhere in your werbservice's code, make a call from the client, and voila! - you are in PHPEd on that line in debugging mode!

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

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