dsaeyrq451928
2016-04-13 08:09
浏览 52
已采纳

在Mac上调试PHP

I use Visual Studio Code IDE on a Mac, and the MAMP stack to develop a website with PHP.

I want to debug the PHP.

I saw this post about debugging PHP with the visual studio code extension: php-debug.

I installed it in my visual studio code but I see that I need to download Xdebug for it to work.

I see on the Xdebug website that it has no download files for Mac OS X.

However, some PHPdebuggers for mac are Xdebug clients for mac. As shown here.

Does this mean that I can somehow download Xdebug for mac OS X so that my Visual Studio Code php-debug extension works?

If so how?

If not, what is my next best option? - Can I use Visual Studio Code IDE to develop with and a completely separate tool to debug PHP with? In that workflow, would I be just running the site in the browser and the third party tool stops on the breakpoints?

I downloaded codebug for mac, and opened my project in it, and put break points on the code, then ran my website locally. The code did not stop on the break points. What was I missing?

Thanks.

图片转代码服务由CSDN问答提供 功能建议

我在Mac上使用Visual Studio Code IDE,使用MAMP堆栈用PHP开发网站。

我想调试PHP。

我看到这篇文章关于使用visual studio代码扩展调试PHP:php-debug。

我将它安装在我的visual studio代码中,但我看到我需要下载Xdebug for 它可以工作。

我在Xdebug网站上看到它没有适用于Mac OS X的下载文件。

但是,mac的一些PHPdebuggers是 Mac的Xdebug客户端。 如此处所示。

这是否意味着我可以以某种方式下载Xdebug for mac OS X,以便我的Visual Studio代码php-debug扩展工作?

如果是这样的话?

如果没有,那么我的下一个最佳选择是什么? - 我可以使用Visual Studio Code IDE开发一个完全独立的工具来调试PHP吗? 在该工作流程中,我是否只是在浏览器中运行该站点而第三方工具在断点处停止?

我已下载 codebug ,并在其中打开我的项目,并在代码上放置断点,然后在本地运行我的网站。 代码没有停在断点上。 我错过了什么?

谢谢。

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • duan00529 2016-04-14 00:50
    已采纳

    The route I took is upgrading to MAMP PRO. It may be possible to do it with MAMP (non-pro) if you do a bit more setup work for Xdebug.

    Upgraded to MAMP PRO and adapted this tutorial for Visual Studio Code. In Visual Studio Code install php-debug, and in MAMP PRO under the PHP tab check the checkbox to debug with Xdebug. Then in Visual Studio Code in the debug view, click the gear icon and choose PHP. This creates a launch.json file. Save the file without changing any defaults, unless you know your xdebug is on a different port. Then just press the play button in the debugger in Visual Studio Code, enter in some breakpoints into the PHP code, and browse to the website. The debugger should stop the execution on the breakpoints.

    点赞 打赏 评论

相关推荐 更多相似问题