Setting up Debugging in MAMP Pro 3.3 and PHPStorm 9

First off, make sure that you have the latest versions of MAMP Pro and PHPStorm installed. At the time of this writing, that is MAMP 3.3 and PHPStorm 9.

  1. In MAMP’s PHP tab, check the option for debugger.
    mamp-debug
  2. Edit /Applications/MAMP/bin/php/php<version>/conf/php.ini. I am currently using 5.4.42.
    1. In the “; Extensions” section, add:
      xdebug.so
    2. Toward the bottom, in the [xdebug] section, add:
      xdebug.remote_autostart=1
      xdebug.remote_enable=1
      xdebug.remote_host=localhost
      xdebug.remote_port=9000
  3. Restart your web server in MAMP Pro.
  4. In PHPStorm, go to File → Default Settings…
  5. Go to Languages & Frameworks → PHP.
  6. Under “Interpreter:”, click …
    interpreter
  7. Click + to add a new interpreter, and for PHP executable, find the location to the PHP binary you’re using in MAMP.
    default-interpreters
  8. Click OK, then select that as the interpreter.
  9. Make sure “PHP language level” is set appropriately (in this case, 5.4), and click OK.
  10. Expand the PHP section in the “Default Preferences” window, click on Debug, make sure the Xdebug port is set to 9000, and click OK.
    default-debug-preferences
  11. Back in the main PHPStorm window, go to Run → Edit Configurations…
  12. Click the + button in the upper-left, then click “PHP Web Application”
    run-debug-configurations
  13. Under Server, click the ellipsis.
  14. Click the + in the upper-left of the Servers dialog to add a new server.
  15. Name it whatever you wish, and for Host use localhost, and make sure port is set to 80 (or whatever your MAMP port is set to).
    servers
  16. Click OK, and select that as your Server on the “Run/Debug Configurations” screen.
  17. Make sure the Browser is set to your browser of choice, and click OK.

Now you should be good to go. Here is an example video of how to debug in PHPStorm.


Category(s): Tools
Tags: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *