This is a subject that seems to come up again and again. I figured this out once before, but back then I was using Eclipse, while I am now a PhpStorm devotee. Also, I've long since started using Vagrant, which means that every debugging scenario is now "remote". Usually, this is not a huge issue, but with command line debugging, this presents a bit of a challenge.
Randy Fay has done a nice write-up back in 2013, which covers most of the bases. It does leave one missing link, which seems to have come up only recently; a recent change in drush has broken debugging through xdebug, because it is now using pcntl_exec() to execute the actual script (don't ask me for the technical details, I haven't delved into that too much). As is so often the case, Stack Exchange provided the missing piece of the puzzle; it's possible to circumvent the "decoupling", that seems to occur due to the pcntl_exec(), by using drush.launcher as the entry point.
As much for my own reference as anyone else's, these are the key points from both Randy's post and the SE topic:
- Set up a "PHP Web Application" for debugging the command line. The sole purpose of this is to be able to provide a path mapping when running the command in Vagrant.
- Enable xdebug debugging for the command line in your Vagrant box. In my case, this simply meant symlinking the same xdebug.ini from my /etc/php5/cli/conf.d directory as I was using in the /etc/php5/apache/conf.d for web debugging.
- All executed code needs to be available in the project, including drush. You can accomplish this by e.g. installing drush as a composer dependency (also, remember to execute drush from your project).
The following you will need to do every debugging session:
- Use PhpStorm's "Listen for PHP Debug connections" button
- Set the remote debug client on the command line using (or whatever is the IP-address for your host machine when coming from the Vagrant box; the xdebug.remote_connect_back that is likely in your config will not work for the command line):
export XDEBUG_CONFIG="idekey=phpstorm remote_host=192.168.33.1"
- Set the server configuration. Make sure the name you use matches the server name you configured in PhpStorm:
export PHP_IDE_CONFIG="serverName=cli"
- Execute drush by substituting "drush.launcher" for the regular drush command. Make sure you use the drush copy from your project. For example:
../vendor/drush/drush/drush.launcher migrate-reset-status posts
Comments
Add new comment | Blokspeed.net
Add new comment | Blokspeed.net
Add new comment | Blokspeed.net
Add new comment | Blokspeed.net
10 Things That Your Family Taught You About Replacement Key Volkswagen Replacement key volkswagen
Add new comment | Blokspeed.net
11 Creative Ways To Write About Birth Injury Attorney Washington County birth injury Attorney baltimore
Add new comment | Blokspeed.net
Add new comment | Blokspeed.net
Who Is Symptoms Of Depression Bipolar And Why You Should Take A Look emotional Warning signs of depression
Add new comment | Blokspeed.net
What You Should Be Focusing On Improving Psychiatrist Assessment Near Me best adhd psychiatrist near me
Add new comment | Blokspeed.net
Add new comment | Blokspeed.net
15 Best Fold Away Treadmill Bloggers You Must Follow best fold away treadmill
Add new comment | Blokspeed.net
5 Must-Know Single Size Mattresses-Practices You Need To Know For 2023
single Double mattress
Add new comment | Blokspeed.net
9 Lessons Your Parents Taught You About L Shaped Leather Sofas L shaped leather Sofa
Add new comment | Blokspeed.net
A Glimpse Inside The Secrets Of All Terrain Folding Electric Wheelchair Uk fold down electric wheelchair; http://webproduce.com.au/bbs/board.php?bo_table=free&wr_id=272081,
Add new comment | Blokspeed.net
10 Things Everyone Makes Up About Glass Repairs Windows glass sliding doors repair (https://gre01.com/bbs/board.php?bo_table=free&wr_id=84097)
Add new comment | Blokspeed.net
Why People Don't Care About Triple Pushchair twin Pushchairs
Add new comment | Blokspeed.net
Electric Treadmill Foldable Explained In Less Than 140 Characters folding Electric treadmill motorized running machine
Add new comment | Blokspeed.net
Why Treadmills Is Fast Increasing To Be
The Most Popular Trend For 2023 Treadmills at Home
Add new comment | Blokspeed.net
What's The Reason? Mental Assessments Is Everywhere This Year mental health trauma assessment (hearaon.Co.kr)
Add new comment | Blokspeed.net
Don't Forget Kia Picanto Spare Key: 10 Reasons Why You Don't Have It How To Take Apart A Kia Key Fob
Add new comment | Blokspeed.net
Why Nobody Cares About New 10kg Washing Machine 023456789
(https://frozenllama.Io/)
Add new comment | Blokspeed.net
What Private Assessment For ADHD Experts Want
You To Be Able To Private assessment for adhd cost
Add new comment | Blokspeed.net
You'll Be Unable To Guess Treadmill Sale UK's Benefits Treadmill sale uk
Add new comment | Blokspeed.net
Add new comment | Blokspeed.net
12 Companies Leading The Way In Built-In Fridge cheap fridges online
Add new comment | Blokspeed.net
It's Time To Increase Your Seat Leon Key Replacement Options replacement key for seat ibiza
Add new comment | Blokspeed.net
5 Laws That'll Help The 3 Wheel Rollators With Seat Industry Three Wheel rollator
Add new comment | Blokspeed.net
The 10 Most Terrifying Things About Freezers Uk freezers Uk
Add new comment | Blokspeed.net
A Rewind What People Said About Autowatch Ghost 2 Installers Near Me 20 Years
Ago autowatch ghost installers near me (www.jj0bn3viuefqbv6k.Com)
Add new comment | Blokspeed.net
15 Gifts For Those Who Are The Fireplaces Electric
Suites Lover In Your Life Fireplace Electric Suite
Saved me. DIdn't see
export PHP_IDE_CONFIG="serverName=cli"
In other pages and I spent a couple hours trying to figure it out.