<p>I have tried:</p>

<ol>
<li>Xdebug and Eclipse. Eclipse launches a web browser, but the browser tries to access a non-existent file in Eclipse's .app bundle.</li>
<li>Xdebug and NetBeans. It does a little bit better; a browser opens a page in /tmp which says "Launching. Please wait…" but nothing happens beyond that.</li>
<li>Xdebug and debugclient, the CLI tool which comes with Xdebug. MacPorts (which I used to install PHP and Xdebug) doesn't seem to install this by itself, and when I try compiling it by hand, I get told "you have strange libedit". Installing libedit via MacPorts doesn't solve that.</li>
<li>Zend's debugger (the precise name escapes me right now) and Eclipse. I can't recall what the problem was, as this was some time ago, but it didn't work.</li>
</ol>

<p>With regards to Xdebug, at least, I'm fairly confident I've installed it correctly. It shows up with both a phpinfo() in a PHP file and a <code>php -i</code> in the CLI.</p>

<p>If anyone has managed to get PHP debugging working in some way or other on the Mac, I'd appreciate it if you could share with me how. Littering code with <code>var_dump($foo);die();</code> gets old quick. Bonus points if it can be done <em>without</em> using some bloatware editor like Eclipse, or that expensive proprietary thing Zend wants to sell me.</p>

<p>My server is connecting to PHP via FastCGI, if that makes a diff.</p>

[{'answer_id': 84513, 'author': 'Gary Richardson', 'author_id': 2506, 'author_profile': 'https://Stackoverflow.com/users/2506', 'pm_score': 0, 'selected': False, 'text': "<p>I guess I don't get bonus points, but Zend Studio works for me on my Mac connecting to Apache running in VMware.</p>\n"}, {'answer_id': 84901, 'author': 'Brian Benzinger', 'author_id': 8096, 'author_profile': 'https://Stackoverflow.com/users/8096', 'pm_score': 5, 'selected': True, 'text': '<p>You may want to look into <a href="http://www.bluestatic.org/software/macgdbp/" rel="noreferrer">MacGDBp</a>. It\'s new, free, and the UI looks great. It utilizes the Xdebug PHP extension as well. You can find instructions in the <a href="http://www.bluestatic.org/software/macgdbp/help.php" rel="noreferrer">help</a> section, which includes Xdebug configurations, and there\'s also a nice overview of the app from the guys at Particletree here: <a href="http://particletree.com/notebook/silence-the-echo-with-macgdbp/" rel="noreferrer">Silence The Echo with MacGDBp</a>.</p>\n'}, {'answer_id': 131855, 'author': 'phatduckk', 'author_id': 3896, 'author_profile': 'https://Stackoverflow.com/users/3896', 'pm_score': 0, 'selected': False, 'text': '<p>I debug PHP CLI scripts and web probject (thru apache etc) using Eclipse &amp; ZendDebugger all the time. </p>\n\n<p>I answered a similar question over at the following link:\n<a href="https://stackoverflow.com/questions/127761/php-debugging-with-aptana-studio-and-xdebug-or-zend-debugger-on-os-x#131722">click here</a></p>\n\n<p>Hopefully that\'s what you\'re looking for.</p>\n'}, {'answer_id': 426452, 'author': 'Luke Dennis', 'author_id': 24010, 'author_profile': 'https://Stackoverflow.com/users/24010', 'pm_score': 4, 'selected': False, 'text': '<p>Here\'s how I did it:</p>\n\n<p>1 - Copy the latest version of xdebug.so from <a href="http://aspn.activestate.com/ASPN/Downloads/Komodo/RemoteDebugging" rel="noreferrer">http://aspn.activestate.com/ASPN/Downloads/Komodo/RemoteDebugging</a> to /usr/libexec.</p>\n\n<p>2 - Add the following to the global php.ini:</p>\n\n<pre><code>zend_extension="/usr/libexec/xdebug.so"\nxdebug.remote_enable=1\nxdebug.remote_host=localhost\nxdebug.remote_port=9000\nxdebug.remote_autostart=1\n</code></pre>\n\n<p>3 - Restart Apache and run <a href="http://www.bluestatic.org/software/macgdbp/help.php" rel="noreferrer">MacGDBp</a>.</p>\n'}, {'answer_id': 3765605, 'author': 'David', 'author_id': 57246, 'author_profile': 'https://Stackoverflow.com/users/57246', 'pm_score': 1, 'selected': False, 'text': "<p>I use Komodo 5 --- debugging works wonderfully, not only with PHP, but also with Ruby and Python.\nI mostly use it to debug PHP scripts that are running on a remote server but you can do local stuff as well. It's not free, but assuming your own time is worth something, you will have gotten your money back within a few hours!</p>\n"}, {'answer_id': 12918754, 'author': 'Henrique B.', 'author_id': 406428, 'author_profile': 'https://Stackoverflow.com/users/406428', 'pm_score': 2, 'selected': False, 'text': '<p>Just wanted to update this thread to let you know there\'s a new app out here <a href="http://codebugapp.com/" rel="nofollow">http://codebugapp.com/</a> it\'s commercial, but it\'s Xdebug client for OSX</p>\n'}, {'answer_id': 38305526, 'author': 'Arif Dewi', 'author_id': 2668045, 'author_profile': 'https://Stackoverflow.com/users/2668045', 'pm_score': 1, 'selected': False, 'text': '<h3>There is a way how to do it using</h3>\n\n<ul>\n<li><a href="https://www.jetbrains.com/phpstorm/" rel="nofollow">PhpStorm</a>   </li>\n<li><p>Homebrew<br>\nruby -e "$(curl -fsSL <a href="https://raw.githubusercontent.com/Homebrew/install/master/install" rel="nofollow">https://raw.githubusercontent.com/Homebrew/install/master/install</a>)"</p></li>\n<li><p>Php + Xdebug</p></li>\n</ul>\n\n<p>1) Install php and debug </p>\n\n<pre><code>brew install php70   \nbrew install php70-xdebug\n</code></pre>\n\n<ul>\n<li><p>In PhpStorm - check Preferences => Language and Frameworks => PHP<br>\nPhp language level: 7<br>\nInterpreter: PHP 7.0.8 + XDebug  (or choose from [...])</p></li>\n<li><p>Check debug config: \nPreferences => Language and Frameworks => PHP => Debug => Xdebug section<br>\nAll checkboxes should be checked and set Debug port to: 9001</p></li>\n</ul>\n\n<p>2) run server in your app\'s directory:   </p>\n\n<pre><code>php -S localhost:8080\n</code></pre>\n\n<p>3) Add localhost:8080 to PhpStorm Preferences => Language and Frameworks => PHP => Servers:<br>\nName: Localhost:8080<br>\nHost: localhost<br>\nPort: 8080<br>\nDebugger: Xdebug   </p>\n\n<p>4) Update php.ini:<br>\nPhp => Interpreter => […] => Configuration file - Open in Editor<br>\nAdd this section: (check zend_extention path through the cli) </p>\n\n<pre><code>[Xdebug]\nzend_extension=/usr/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so\nxdebug.remote_enable=1\nxdebug.remote_host=localhost\nxdebug.remote_port=9001 (same as in Debug preferences)\n</code></pre>\n\n<p>5) Add Debug Configuration:\nRun => Edit Configuration => add - Php Web Application</p>\n\n<ul>\n<li>Choose Localhost:8080 server</li>\n</ul>\n\n<p>6) Click Start Listening for Php Debug Connections<br>\n7) Set up breakpoints<br>\n7) Click on Debug (Green bug)</p>\n'}, {'answer_id': 39327220, 'author': 'Aurovrata', 'author_id': 3596672, 'author_profile': 'https://Stackoverflow.com/users/3596672', 'pm_score': 0, 'selected': False, 'text': '<p>If you are using MAMP, please note that it has 2 php.ini files that need to be updated.  It took me hours to figure this one out.  The two files are in the following folders for MAMP 4, </p>\n\n<pre><code>/Applications/MAMP/bin/php/php5.6.25/conf/php.ini\n/Applications/MAMP/conf/php5.6.25/php.ini\n</code></pre>\n\n<p>if you\'re using php7 then you\'ll need to update those files instead. Scroll to the bottom of the files and make sure you have the following entries,</p>\n\n<pre><code>[xdebug]\nzend_extension="/Applications/MAMP/bin/php/php5.6.25/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so"\nxdebug.default_enable=1\nxdebug.remote_enable=1\nxdebug.remote_host=localhost\nxdebug.remote_port=9000\nxdebug.remote_autostart=1\n</code></pre>\n\n<p>Then make sure you restart your server else the new settings won\'t be loaded.  To make sure Xdebug is working properly, open your MAMP Start page, and click onthe phpinfo tab.  Search for xdebug in the listing, you should see the <a href="http://www.codeforest.net/wp-content/uploads/2013/04/phpinfo.png" rel="nofollow">Xdebug section</a> that shows that the extension is loaded and enabled, else something is wrong with the above configurations.</p>\n\n<p>Next you can launch MacGDBp and it will connect to port 9000 and allow you to debug your files.  </p>\n\n<p>NOTE: If you are developing on Wordpress, then make sure you skip the \'AJAX\' debugging sessions.  These are regular as the Dashboard will ping the server for changes.  If you enable the \'break on the first line\' in MacGDBp settings, you will see the ajax sessions breaking on the line <code>define (\'DOING_AJAX\')....</code> which you can skip.  Once you have then fire your event for debugging your code.</p>\n'}]
['https://Stackoverflow.com/questions/80351', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/11023/']