简体   繁体   English

如何在IIS中调试PHP?

[英]How can I debug PHP in IIS?

I'm starting to move some sites to WordPress hosted in IIS7 using PHP 5.3 & FastCGI. 我开始使用PHP 5.3和FastCGI将一些站点移动到IIS7中托管的WordPress。 I'm quickly finding that while the core of WordPress seems to work just fine out of the box, there are a number of plugins that have issues running in IIS and I'd like to be able to debug them, fix them, and submit patches. 我很快发现虽然WordPress的核心似乎开箱即用,但是有很多插件在IIS中运行有问题,我希望能够调试它们,修复它们并提交补丁。

The only solution I've found is to run WordPress in Apache on Windows to debug, but the issues appear to be related to how IIS & FastCGI work with PHP and not so much from being on Windows. 我发现的唯一解决方案是在Windows上的Apache中运行WordPress进行调试,但问题似乎与IIS和FastCGI如何与PHP协同工作有关,而不是与Windows相关。 I've looked at both Expression Web 3 and Aptana Studio 1.5 but could not find a way to do this with either tool. 我已经看过Expression Web 3和Aptana Studio 1.5,但无法用这两种工具找到方法。

Is there any ways to debug WordPress (or PHP in general) running under FastCGI on IIS7? 有没有办法在IIS7上调试在FastCGI下运行的WordPress(或一般的PHP)? What tools are needed, and specific steps would be appreciated. 需要什么工具,具体步骤将不胜感激。

XDebug is a very very good tool for debugging PHP. XDebug是一个非常好的调试PHP的工具。

If you are using an IDE like Netbeans , XDebug allows you to run your PHP code on a local server in step-through mode, with break points and variable watches. 如果您使用的是像Netbeans这样的IDE,XDebug允许您以步进模式在本地服务器上运行PHP代码,并使用断点和变量监视。 Very very powerful and extremely easy to use. 非常强大,非常容易使用。

I would suggest doing a phpinfo() and pasting the output here that's XDebug a very good debugger with Windows binaries on their site. 我建议做一个phpinfo()并粘贴输出这是XDebug一个非常好的调试器,在他们的网站上有Windows二进制文件。 Now whatever editor you're using needs to support xdebug in order to have that step-by-step thing. 现在,无论你使用什么编辑器都需要支持xdebug才能拥有一步一步的东西。

Also you should look at FirePHP which is a plug-in for Firebug in Firefox. 另外你应该看一下FirePHP ,它是Firefox中Firebug的一个插件。 It's sort of in between the print_r(); 它介于print_r()之间; and xdebug or... 和xdebug或......

Finally look at dbg which will also work on windows. 最后看看dbg,它也适用于Windows。 In this post there is some configuration information for IIS, just ignore the stuff about VS.php. 在这篇文章中有一些IIS的配置信息,只是忽略了关于VS.php的东西。

Hope all that helps. 希望一切都有所帮助。

I've debugged alot of PHP on windows and never had that much of a problem, it would help to know what you are trying to use to debug things and what errors you are running into. 我已经在Windows上调试了很多PHP并且从来没有遇到过这么多问题,这将有助于了解您尝试使用什么来调试事物以及您遇到的错误。 Generally the errors you might have are stuff to do with Apache functions and/or presumptions made about $_SERVER[]. 通常,您可能遇到的错误与Apache函数和/或有关$ _SERVER []的假设有关。

Anyhow, given FastCGI likely isn't the problem, I would setup the dev environment to run as normal CGI which should be a bit easier for the debugger to access. 无论如何,鉴于FastCGI可能不是问题,我会设置开发环境以正常CGI运行,调试器访问应该更容易一些。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM