如何在服务器端调试php脚本?在这种情况下,客户端页面不显示响应 [英] How to debug php scripts at server side? In a situation client page doesn't show response
问题描述
我目前正在主机上测试脚本.该脚本用于接受PayPal IPN数据,执行一些操作(即数据验证),将必要的数据发送到特定的电子邮件地址等等.
I'm currently testing a script on my host. This script is to accept PayPal IPN data, do a couple of things (ie. data verification), send necessary data to a specific email address, and more.
我正在PayPal网站上使用测试工具将测试数据发布到我的脚本中.我的脚本不起作用:应该发出了代码,但看不到错误.贝宝(PayPal)中的测试工具只是在张贴帖子,并且似乎不接受任何回复.我想看看脚本中发生了什么,以便可以对其进行修复.如何获得脚本输出的错误消息?
I'm using a test tool on the PayPal site to post test data to my script. My script doesn't work: there should be a code issued but I can't see the error. The test tool in PayPal just does the post and doesn't seem to accept any response. I want to see what happened in my script so that I can fix it. How can I get error messages my script outputs?
有什么想法吗?
推荐答案
更好的方法是将错误记录到文件中,而不是屏幕"中.如果在服务器范围内进行更改,则服务器上的其他站点很可能会受到影响.
A better approach would be to log the errors to a file, and not the 'screen'. If you make a server wide change, it's probable that other sites on the server will be affected.
- log_errors =开启
- display_errors =关闭
- error_log =/tmp/php.log(或者您选择的更好的路径;文件可能需要由Apache/webserver写入).
上述所有操作均失败,请安装 xdebug 并尝试调试代码-您可以逐行进行检查随意设置变量-也许这会让您有个更好的主意.
Failing all of the above, install xdebug and try debugging the code - you can step through line by line and inspect variables at will - perhaps this will give you a better idea.
如果失败,请诉诸var_dump()和朋友.
Failing that, resort to var_dump() and friends.
这篇关于如何在服务器端调试php脚本?在这种情况下,客户端页面不显示响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!