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
5 Killer Quora Answers To Robot Vacuum Cleaner Uk robot vacuum cleaner uk
(https://hedgedoc.eclair.ec-lyon.fr/vn58_5rkrgo0yqls44osgg)
Add new comment | Blokspeed.net
Is Tech Making Best Robot Cleaner Better Or Worse?
Ai Vacuum cleaner
Add new comment | Blokspeed.net
Robot Vacuum And Cleaner Tools To Streamline Your Everyday Lifethe Only Robot Vacuum
And Cleaner Technique Every Person Needs To Know robot vacuum and Cleaner
Add new comment | Blokspeed.net
The 10 Most Terrifying Things About Automatic Hoover Uk automatic hoover (riise-macgregor.Thoughtlanes.Net)
Add new comment | Blokspeed.net
15 Best Robot Vacuum Cleaners Bloggers You Should Follow best robot vacuum Cleaners
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
The Lesser-Known Benefits Of Robot Vacuum Cleaners Uk autonomous vacuum
Add new comment | Blokspeed.net
What's The Job Market For Autonomous Vacuum Professionals
Like? Autonomous Vacuum
Add new comment | Blokspeed.net
What's The Current Job Market For Which Robot
Vacuum Cleaner Professionals? Which Robot Vacuum Cleaner
Add new comment | Blokspeed.net
You'll Never Guess This Autonomous Vacuum's Tricks autonomous Vacuum
Add new comment | Blokspeed.net
The 10 Most Scariest Things About Robot Vacuums & Mops robot Vacuums & mops
Add new comment | Blokspeed.net
Nine Things That Your Parent Teach You About Robotic Vacuum Cleaner Uk Robotic Vacuum Cleaner Uk
Add new comment | Blokspeed.net
14 Smart Ways To Spend Your The Leftover Automatic Hoovers Budget robotic floor Cleaner
Add new comment | Blokspeed.net
What's The Job Market For Robot Vacuum Cleaner Professionals?
robot vacuum cleaner - codimd.fiksel.info,
Add new comment | Blokspeed.net
Robot Vacuum And Cleaner Tools To Streamline Your Daily Lifethe
One Robot Vacuum And Cleaner Trick Every Individual Should Know Robot Vacuum
Add new comment | Blokspeed.net
15 Weird Hobbies That Will Make You More Successful At Robotic Vacuum Robotic vacuum cleaner
Add new comment | Blokspeed.net
Robot Robotic Vacuum Cleaners Tools To Ease Your Daily Lifethe One Robot
Robotic Vacuum Cleaners Trick That Everybody Should Be Able To robot Robotic Vacuum cleaners
Add new comment | Blokspeed.net
What's The Current Job Market For Best Automatic Vacuum Cleaner Professionals?
automatic vacuum cleaner (157.230.187.16)
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
Five Automatic Vacuum Cleaner And Mop Projects For
Any Budget automatic Cleaner
Add new comment | Blokspeed.net
Robot Vacuum And Cleaner Tools To Streamline Your Daily Life Robot Vacuum And Cleaner Trick That Should Be Used By Everyone Know robot vacuum And Cleaner
Add new comment | Blokspeed.net
You'll Never Guess This Robot Mop Uk's Tricks robot mop Uk
Add new comment | Blokspeed.net
The Best Automatic Hoover Tricks For Changing Your Life Best automatic hoover
Add new comment | Blokspeed.net
5 Killer Quora Answers On Robot Vacuum Cleaner Uk
Robot Vacuum cleaner uk
Add new comment | Blokspeed.net
The 10 Most Scariest Things About Best Robotic Vacuum Cleaners best robotic vacuum cleaners
Add new comment | Blokspeed.net
Cheap Robot Hoover Tools To Streamline Your Daily Life Cheap Robot Hoover Trick That Should Be Used
By Everyone Be Able To Cheap Robot Hoover
Add new comment | Blokspeed.net
Guide To Robot Vacuum Cleaner With Mop: The Intermediate Guide For Robot Vacuum Cleaner With Mop Robot Vacuum Cleaner With Mop
Add new comment | Blokspeed.net
How To Create Successful Robot Cleaners Uk Tutorials On Home Robot Vacuum Cleaners
Add new comment | Blokspeed.net
Guide To Push To Start Key Repair: The Intermediate
Guide For Push To Start Key Repair Push To Start Key Repair
Add new comment | Blokspeed.net
Nine Things That Your Parent Teach You About Robot Vacuum
Cleaner Robot vacuum cleaner
Add new comment | Blokspeed.net
What Is The Secret Life Of Buy Cleaning Robot smart floor vacuum
Add new comment | Blokspeed.net
7 Simple Secrets To Completely You Into Best Robot Vacuum And Mop Best Robot Vacuum And Mop UK
Add new comment | Blokspeed.net
What's The Current Job Market For Which Robot Vacuum Cleaner
Professionals Like? Which Robot Vacuum Cleaner; Nerdgaming.Science,
Add new comment | Blokspeed.net
The Best Automatic Vacuum Cleaner And Mop Tricks To Transform Your Life
Best automatic Vacuum cleaner
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 Reason Everyone Is Talking About Robot Cleaners Uk Right Now Buy Robot Cleaner
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.