Always make sure your test installation is reachable at the docroot: instead of. NB: some Functional Tests fail when you run drupal from a subdir. Sanity check #2: Now if you enable debug listening in PhpStorm and run a Drush command (drush status) your debugger should halt at the first line of the drush php script file in PhpStorm. If not, make sure your php command uses the correct php executable, set the correct path variable in your shell if needed: export PATH=/Applications/MAMP/bin/php/php7.1.0/bin:$PATH This should report your ini settings above. I recommend to use the same php version and same php.ini on the CLI that you use in your webserver, so you only need to set your config in one place. Otherwise you will need to make sure the CLI php.ini (there usually is a separate CLI version) has the debug config info set. In MAMP PRO 4 got to PHP > Default version and enable "Make this version available on the command line". Next enable command line (CLI) debugging. Sanity check#1: Now if you enable debug listening in PhpStorm and set a breakpoint in index.php and reload your local Drupal installation in your browser your debugger should halt at the breakpoint in PhpStorm. Otherwise locate your local webserver's php.ini and add the following: zend_extension="" Hey, sometimes I post new content, so if you want to stay up to date sign up for my newsletter.In MAMP PRO got to PHP > Extentions and enable Xdebug. Just use another version of PHP within MAMP, one that doesn’t use Xdebug. Not sure what the reason is, but the workaround is easy enough. I should note that if you’re running multiple sites on your MAMP install, and 2 of these sites are talking to each other in any way (via AJAX or the WP Rest API etc.), make sure ONLY ONE is running Xdebug. Without the explicit path mappings for the symlinks, Xdebug half worked – which was super confusing… I even needed to map the base of my WP install, since I had checked the ‘Use path mappings’ setting.įor me, that’s all it took to get things running. If you’re using plugins in your local PHP install that are symlinked (and many plugin developers do this), make sure you map those folders for Xdebug and PHPStorm! This is where I got caught many times. You can set this in Preferences > Languages & Frameworks > PHP and selecting the MAMP PHP version you’re using.Īfter that, essentially follow Michael’s guide for setting up PHPStorm with the debug configurations, once PHP is all set up. Make sure PHPStorm is using the same PHP Interpreter you’re using for everything else. You can further check what kind of Xdebug settings your have enabled by running php -i | grep xdebug You can check if Xdebug is available, by running php -version in your CLI. There’s plenty of resources on the inter-web’s for this. Make sure you’ve got Xdebug running and remote_enable=1 is set in your php.ini. This one’s a gimme, but still a point worth making to cover all the bases. In your ~/.bash_profile file you can add something like this.Įcho $PATH | grep -q -s "/Applications/MAMP/bin/php/php5.6.10/bin"Įxport MAMP_PATH=/Applications/MAMP/bin/php/php5.6.10/bin This can be as simple as adding the MAMP PHP version to your $PATH. This can cause all sorts of weirdness, especially with Xdebug, so make sure you’re using your MAMP version of PHP on your CLI. Time and again I’ve seen people have issues with their CLI PHP version and Web server PHP version not matching up. Step 0: Use the same version of PHP for your CLI and your webserver. You’re on a recent version of OSX, you have MAMP Pro 3 installed, and you’re using PHPStorm. There’s just one missing piece, for me, and that was how to handle symlinks in your plugins. I followed Michael Novotny’s post on this, and it almost works. ![]() ![]() This time I decided to document how I was able to get it working this time, so hopefully I don’t have suffer through this again. There’s always something that get’s me caught up and messed up. I’ve probably set it up, in various incarnations, close to 10 times. ![]() While true, it’s also one of the biggest pain in the asses to setup. Written by Peter Tasker Open source developer in Ottawa Ontario, Canada You should follow him on Twitter MAMP, Xdebug, PHPStorm and symlink madnessĪsk any PHP developer and they’ll tell you Xdebug is the best thing since sliced bread.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |