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
Egzamin Na Prawo Jazdy Online: Nowa Era Egzaminowania Kierowców egzamin na Prawo jazdy online
Add new comment | Blokspeed.net
The Evolution And Importance Of Push Chairs And Prams In Modern Parenting push chairs And prams
Add new comment | Blokspeed.net
Guide To Car Key Ignition Switch Repair: The Intermediate Guide On Car Key
Ignition Switch Repair Car Key Ignition Switch Repair (Https://www.laba688.com/)
Add new comment | Blokspeed.net
5 Killer Quora Answers On Keyless Ignition Repair Keyless
Ignition Repair - mcbride-smith.blogbright.net -
Add new comment | Blokspeed.net
Car Ignition Repair Tools To Help You Manage Your Daily Life Car Ignition Repair Trick Every
Person Should Be Able To Car Ignition repair
Add new comment | Blokspeed.net
11 Ways To Totally Block Your Keyless Entry Remote Repair
Car Keyless Entry Remote Repair (www.ydaojia.com)
Add new comment | Blokspeed.net
Guide To Car Key Sensor Repair: The Intermediate
Guide The Steps To Car Key Sensor Repair Car Key Sensor Repair
Add new comment | Blokspeed.net
Guide To Car Key Sensor Repair: The Intermediate Guide To Car Key Sensor Repair car key
sensor repair, md.kif.rocks,
Add new comment | Blokspeed.net
Car Remote Key Repair Tools To Ease Your Daily Life Car Remote Key Repair Technique Every Person Needs To Be Able To Car Remote Key Repair
Add new comment | Blokspeed.net
Speak "Yes" To These 5 Smart Key Repair Tips Car Smart Key Repair
Add new comment | Blokspeed.net
Add new comment | Blokspeed.net
Five Things Everybody Gets Wrong About Car Key Signal Issue Repair Car Key Ignition Switch Repair
Add new comment | Blokspeed.net
See What Car Key Blade Repair Tricks The Celebs Are Utilizing Car Key Blade Repair
Add new comment | Blokspeed.net
One Of The Biggest Mistakes That People Make With Car Key Repair Emergency Car Key Repair; theflatearth.win,
Add new comment | Blokspeed.net
Guide To Push To Start Key Repair: The Intermediate
Guide To Push To Start Key Repair Push To Start Key Repair,
https://Imoodle.Win,
Add new comment | Blokspeed.net
The 10 Scariest Things About Keyless Entry Remote Repair
keyless Entry remote repair (clinfowiki.win)
Add new comment | Blokspeed.net
Guide To Car Keyless Entry Fob Repair: The Intermediate Guide On Car Keyless Entry Fob Repair Car Keyless Entry Fob
Repair (Fkwiki.Win)
Add new comment | Blokspeed.net
The Top Reasons People Succeed In The Keyless Entry Remote Repair Industry
Car Keyless Entry Remote Repair
Add new comment | Blokspeed.net
See What Ignition Key Repair Tricks The Celebs Are Using
Ignition Key Repair (Foreman-Heath-2.Technetbloggers.De)
Add new comment | Blokspeed.net
Nine Things That Your Parent Teach You About
Emergency Car Key Repair car Key repair
Add new comment | Blokspeed.net
Guide To Car Keyless Entry Fob Repair: The Intermediate Guide To Car
Keyless Entry Fob Repair Car Keyless Entry Fob Repair
Add new comment | Blokspeed.net
Key Stuck In Ignition Repair Tools To Make Your Daily Life
Key Stuck In Ignition Repair Trick That Every Person Must Know key stuck in Ignition repair - md.swk-web.com,
Add new comment | Blokspeed.net
Car Remote Key Repair Tools To Make Your Daily Lifethe One
Car Remote Key Repair Trick That Every Person Must
Be Able To Remote Key Repair
Add new comment | Blokspeed.net
What's The Current Job Market For Keyless Fob Repair Professionals Like?
Add new comment | Blokspeed.net
A Step-By-Step Guide To Smart Key Repair From Start To Finish Car Smart Key Repair
Add new comment | Blokspeed.net
Guide To Car Key Sensor Repair: The Intermediate Guide In Car
Key Sensor Repair Car Key Sensor Repair
Add new comment | Blokspeed.net
Five Killer Quora Answers To Keyless Ignition Repair Keyless Ignition Repair
Add new comment | Blokspeed.net
What's The Current Job Market For Car Key Jammed Repair Professionals?
car Key jammed repair
Add new comment | Blokspeed.net
The 9 Things Your Parents Taught You About Vehicle Key
Repair Vehicle Key Repair (Lancaster-Finley.Mdwrite.Net)
Add new comment | Blokspeed.net
What's The Job Market For Car Key Jammed Repair Professionals Like?
Add new comment | Blokspeed.net
9 Things Your Parents Teach You About Car Key Housing Repair car key housing repair
Add new comment | Blokspeed.net
5 Killer Quora Answers On Keyless Entry Remote Repair Keyless Entry Remote Repair
Add new comment | Blokspeed.net
Guide To Car Remote Start Repair: The Intermediate Guide For Car
Remote Start Repair car remote start repair
Add new comment | Blokspeed.net
20 Quotes That Will Help You Understand Keyless Fob Repair Vehicle Keyless Start Repair
Add new comment | Blokspeed.net
What's The Current Job Market For Key Fob Repair
Professionals? key fob repair
Add new comment | Blokspeed.net
Smart Key Repair Tools To Improve Your Everyday Lifethe Only Smart Key Repair Technique
Every Person Needs To Learn Smart Key Repair
Add new comment | Blokspeed.net
What's The Job Market For Car Keyless Start Repair Professionals?
Car Keyless Start Repair (https://Createyourdestiny.us/members/kneevessel59/activity/263223)
Add new comment | Blokspeed.net
Guide To Push To Start Key Repair: The Intermediate Guide To Push To Start Key Repair
Push To Start Key Repair
Add new comment | Blokspeed.net
See What Ignition Key Repair Tricks The Celebs Are Utilizing Ignition Key Repair
Add new comment | Blokspeed.net
15 Twitter Accounts That Are The Best To Discover More About Keyless Remote Repair
Emergency Key Repair
Add new comment | Blokspeed.net
What's The Current Job Market For Car Key Jammed Repair Professionals?
Car Key Jammed Repair
Add new comment | Blokspeed.net
What's The Current Job Market For Car Keyless Entry System Repair
Professionals Like? Car Keyless Entry System Repair
Add new comment | Blokspeed.net
Guide To Car Door Lock Repair: The Intermediate Guide In Car Door Lock
Repair Car Door lock repair
Add new comment | Blokspeed.net
What's The Job Market For Car Keyless Start Repair Professionals Like?
Car Keyless Start Repair
Add new comment | Blokspeed.net
Nine Things That Your Parent Teach You About Car Key Housing
Repair car key housing Repair
Add new comment | Blokspeed.net
10 Essentials Regarding Experienced Car Key Repair You Didn't Learn At School Car Key Repair Service
Add new comment | Blokspeed.net
Guide To Car Door Lock Repair: The Intermediate Guide Towards Car Door Lock Repair
Car Door Lock Repair
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.