I'm a big fan of PHPStorm. It has made my PHP development life so much easier, especially with debugging. I've been trying to debug a PHP script from the command line (to diagnose a cron job that runs on our server) and here's how you can do it using PHP Storm.
Note: This tip assumes that you already have PHP Storm running and debugging is successfully working. If you don't, check out this article on how you can get things setup.
The first thing to do is to start up your site to debug as usual. Click the icon or hit Ctrl+D (or ^D for Mac users) to launch.
The next step is to grab the "idekey" used by PHPStorm when it launched the debugger and add this to your CLI path environment. To do this, simply execute the following:
- Finally, execute your PHP statement from the command prompt in your project directory. You should hit the proper breakpoints if you have them set.
That's it! I can't believe it took me this long to piece it together!