For MAMP, that path will look something like this depending on the version of PHP: To make Xdebug available to each one, you can set its path in the "Debugger extension" setting. I've added each of the PHP binaries for versions 5.3 through 7 that come with MAMP. To get to this quickly, use Help > Find Action (on macOS use Cmd-Shift-A) and type "CLI Interpreter" (you won't have to type all of it). There is a project setting for CLI Interpreter with a little ellipsis button.Ĭlick that to open a CLI Interpreter settings, where you can tell PhpStorm where to find any versions of PHP you can access to, both locally and remotely. Go to Preferences > Languages & Frameworks > PHP. I imagine there's a way to do this with environment variables or command line switches, but I wasn't able to find one that worked for me. This is actually a good thing, because Xdebug slows down PHP a lot, but you still need it when you want to debug. It includes Xdebug with all its PHP versions, which can be turned on in the PHP tab of its settings:īut if you run a command-line script like Drush or Artisan from the command line, even if you run them through the MAMP php binaries (see below), Xdebug will not be loaded automatically. I'm currently using MAMP Pro, about which I feel less cool all the time, but it continues to serve me well and not cause problems for the size of projects I'm usually working on. If all goes well, execution will stop at the breakpoint and you'll be off to the debugging races. Here's how this will work: you'll do some initial configuration in PhpStorm and your local web stack, set a breakpoint somewhere in your code, then run your command line script from within PhpStorm. Incidentally, if you've never tried a real debugger in your projects, you can check out my talk from WordCamp Orange County, "Let's Debug for Real", which was recorded from the audience, or a higher-fidelity version from a JavaScript perspective, my course Debugging the Web: JavaScript. Here's how I am currently working with all of these tools together. Working for years with Drupal's command-line tool drush, and more recently with Laravel's artisan, I've had occasion to interface with Xdebug in my favorite IDE, PhpStorm.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |