MvKooten
MvKooten

Reputation: 39

Setting up XDebug on MAMP PRO with PHPStorm and Virtual Hosts

I'm new to debugging and finally found some time to play with it. But I can't get the debugger to work in PHPStorm (2.1).

I'm on a Mac (Snow Leopard) and using MAMP PRO (2.0.1). XDebug is installed (default MAMP - 2.1.0) and active.

One of the tutorials I've followed is this one: http://blog.jetbrains.com/webide/2011/02/zero-configuration-debugging-with-xdebug-and-phpstorm-2-0/

And I used this tool for generating bookmarks: http://www.jetbrains.com/phpstorm/marklets/

In PHPStorm I click on the "Start Listen PHP debug connections" button and in the web browser I use the link "Start debugger". Then I refresh the webpage and expect something to happen in PHPStorm. But nothing happens.

Something should happen, right?

I think it probably has something to do with the virtual hosts (created in MAMP PRO) I'm using. When I'm working on a project I'm using URLS like dev.companyname.com

Can it run with different virtual hosts or do I have to use 'localhost'? How can I get this thing to work?

Upvotes: 3

Views: 9482

Answers (2)

coop
coop

Reputation: 911

Lots of answers out there for old versions. Very simple with Mamp 2.2 and PHPStorm 7.1 (OSX 10.9)

MAMP:

Edit the PHP.ini for the version you are using through MAMP to enable XDebug, just as Allen describes, removing the ';' in front of the zend_extension and add xdebug.remote_enable=1

PHP Storm:

  1. Run->Edit Configurations

  2. Add a new PHP Web Application

  3. Configure a new Server, host is 'localhost' and port is '8888', and set the start URL (/myapp)

That's it, hit debug and you are good to go, that easy.

Upvotes: 0

Allen Liu
Allen Liu

Reputation: 4038

I was having the same issue getting XDebug to work with MAMP Pro and PHPStorm but I finally figured it out. Here is what I did:

  1. Edit the php.ini file by launching MAMP and then going to File->Edit Template->PHP->your PHP version and add:

    [xdebug] zend_extension="/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
    xdebug.remote_enable=1

  2. Add bookmarklets for Start debugger, Stop debugger, and Debug this page from this bookmarklet generator

  3. Set a break point in PHPStorm that you want to trigger
  4. Click the Start debugger bookmarklet
  5. In PHPStorm, click on the Start Listen PHP debug connections icon
  6. Load the page that will trigger the breakpoint and that should do it

For details, here is the Jetbrains tutorial post.

Upvotes: 13

Related Questions