Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 427
MvKooten Avatar asked May 14 '26 20:05

MvKooten


1 Answers

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.

like image 130
Allen Liu Avatar answered May 19 '26 04:05

Allen Liu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!