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.

  • 写回答

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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 安装svn网络有问题怎么办
  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥15 latex怎么处理论文引理引用参考文献