Settings up xdebug on MAMP PRO

Viewed 33193

I am trying to set up xdebug on mamp pro with no success. I searched all over the internet, nothing helped me.

First I have tried just to uncomment the following line in php.ini:

zend_extension="/Applications/MAMP/bin/php/php5.4.4/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"

Next, I've tried the wizard: http://xdebug.org/wizard.php

Next, I've tried adding these lines to php.ini:

xdebug.default_enable=1

xdebug.remote_enable=1

xdebug.remote_handler=dbgp

xdebug.remote_host=localhost

xdebug.remote_port=9000

xdebug.remote_autostart=1

Nothing helps. I can't see xdebug in my phpinfo.

MAMP PRO Version: 2.1.1

PHP Version: PHP 5.4.4

Thanks!

2 Answers

I had trouble with setting up MAMP Pro and nginx myself and the above answer did not work for me.

The problem was that the default port setting is 9000, which in my case I have that port already in use so I looked in my nginx conf at this line:

location ~ \.php$ {
            try_files        $uri =404;
            fastcgi_pass     unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock;
            fastcgi_param    SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include          fastcgi_params;
        }

then go to the file located when fastcgi_pass is set to, and in there you will find the correct port number. In my case it was in Applications/MAMP/Library/logs/fastcgi and the filename is dependent on your host's php version.

Then open that file, and set whatever PID is in there to xdebug.remote_port in php.ini, for me it was 13267.

It may be worthwhile to mention my MAMP config for PHP is set to CGI mode, not modules.

EDIT:

I just realized that the port number dynamically changes way too much. So I set a hardcoded value for fastcgi pass in my nginx template for MAMP like so:

fastcgi_pass      127.0.0.1:9072;
# comment out the regular setting just in case.
# fastcgi_pass     unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock;
Related