Here's how I managed to get it to work with w / mulitple PHP-FPM homebrew installations.
I used this wonderful article for several installations:
https://echo.co/blog/os-x-1010-yosemite-local-development-environment-apache-php-and-mysql-homebrew
In the comments of this post you will see how to install xdebug, the bottom line:
brew install php56-xdebug
You need to install xdebug for all PHP versions that you have installed. Homebrew will create an xdebug.ini file for each version of php you install. Each of them will have the following path:
/usr/local/etc/php/<version
This article describes DNSMasq, which runs on the xdebug port by default (9000), so you need to change the xdebug port to something else (9001 works fine.)
Edit the above ext-xdebug.ini file (or files if you have installed more than one php version.) Here is what works for me:
[xdebug] zend_extension="/usr/local/opt/php56-xdebug/xdebug.so" ; General config ; Dumps local variables on exception xdebug.show_local_vars=On ; Dump server variables xdebug.dump.SERVER=* ; Dump global variables xdebug.dump_globals=On xdebug.collect_params=4; ; Tracing ;xdebug.auto_trace=On ;xdebug.trace_output_dir= /opt/local/php_traces/ xdebug.show_mem_delta=On xdebug.collect_return=On ; Debugging. You might need to specify your host with some additional options xdebug.remote_enable=1 : from http://devzone.zend.com/1147/debugging-php-applications-with-xdebug/ xdebug.remote_host="localhost" xdebug.remote_port=9001 xdebug.remote_handler="dbgp"
The first two lines are all that is in the source homebrew file.
BTW - when I installed several versions of PHP, this ext-xdebug.ini file was created only for the first version of PHP that I installed. I just copied this file to other places in the PHP version and changed part of the “php56-xdebug” path in line 2 to display the correct php version.
Pay attention to "xdebug.remote_port = 9001"
Then in Netbeans (I use Mac OSO 10.02 osX10.10.3), I use the following settings. Go to Settings-> PHP-> Debugging
Debug Port: 9001
Stop on the first line: ( not marked )
Clock and ball rating: ( marked ) - there is a warning, but it works fine for me.)
It is also worth noting that in order for xdebug to be displayed using phpinfo () (or the php -i command line), I need to restart apache with
launchctl unload -Fw ~/Library/LaunchAgents/homebrew.mxcl.php56.plist sudo apachectl restart launchctl load -Fw ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
For some reason, my installation requires me to run it every time I start it. Kind of pain, but I included it in the shell command to easily switch between versions.
Another hint: the brew info php56 part says:
OS X 10.8 and newer come with php-fpm pre-installed, to ensure you are using the brew version you need to make sure /usr/local/sbin is before /usr/sbin in your PATH: PATH="/usr/local/sbin:$PATH"
Until I added this to the .profile_bash file, the changes I made to each php-fpm.conf version file were not recognized. Everything else seemed to work, so this is confusing.
Hope this saves someone time and trouble.