drruhc4944 2018-05-11 00:22
浏览 70

如何使用ddev和PhpStorm逐步调试drush命令?

I need to debug a drush command in a ddev project, but I don't know how to do it. In ddev v0.18.0, the PhpStorm debugger breaks at the beginning, but it can't find the associated code.

  • 写回答

2条回答 默认 最新

  • dongzhiji0814 2018-05-11 00:22
    关注

    PHPStorm provides a very nice way to do this, and ddev makes it super easy with the automatic debugging setup.

    This technique works best for a Drupal 8 site with drush vendored in, like you get with drupal-composer setups. It assumes that drush is vendored into vendor/drush/drush.

    This PHPStorm blog post explains the technique.

    1. Create a server in PHPStorm (Project settings->Servers). My "server" name is d8composer. It doesn't matter what you call it, you just need to use it later.
    2. In the PHPStorm server configuration, map your host project directory to /var/www/html:

    server path mappings

    1. Click the "Listen for Debug Connections" button.
    2. Click a breakpoint at a place you know should be hit by your drush command.

    3. Inside the container (ddev ssh), export PHP_IDE_CONFIG="serverName=d8composer" - Yours will be named something other than d8composer of course.

    4. Inside the container /var/www/html/vendor/drush/drush/drush uli (or whatever command you want). PHPStorm will break at your breakpoint. (Of course you could execute that command many ways, but the point is you need to execute the version of drush that's vendored into the repo.

    On earlier versions of drupal you can actually just put a copy of drush into your repo temporarily to solve the mapping problem in the same way.

    Note that Matt Glaman also wrote a blog post on Xdebug Over the Command Line with DDEV

    评论

报告相同问题?

悬赏问题

  • ¥15 python变量和列表之间的相互影响
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)