views:

2132

answers:

7

I have tried:

  1. Xdebug and Eclipse. Eclipse launches a web browser, but the browser tries to access a non-existent file in Eclipse's .app bundle.
  2. 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.
  3. 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.
  4. 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.

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 php -i in the CLI.

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 var_dump($foo);die(); gets old quick. Bonus points if it can be done without using some bloatware editor like Eclipse, or that expensive proprietary thing Zend wants to sell me.

My server is connecting to PHP via FastCGI, if that makes a diff.

+1  A: 

Been looking for php debugger for osx myself too. This one looks promising: http://www.turingart.com/phpdebugger_lan__en.htm

So close, yet so far… This requires PHP 5. Unfortunately, the D-list webhost my company is adhered to still uses PHP 4, so I have to stick with it at work (where I do most of my coding). This looks like a pretty easy-to-use option, though. I'll try it the next time I'm coding at home.
Garrett Albright
A: 

I guess I don't get bonus points, but Zend Studio works for me on my Mac connecting to Apache running in VMware.

Gary Richardson
Which OS are you virtualizing? Are you running Zend Studio in VMware as well?
Garrett Albright
I'm virtualizing Linux only. I think use samba to mount the code and edit it from the Mac running Zend Studio.
Gary Richardson
+10  A: 

You may want to look into MacGDBp. It's new, free, and the UI looks great. It utilizes the Xdebug PHP extension as well. You can find instructions in the help section, which includes Xdebug configurations, and there's also a nice overview of the app from the guys at Particletree here: Silence The Echo with MacGDBp.

Brian Benzinger
Now that looks *really* nice. But it too requires PHP 5, which I don't have access to at work. I can't wait to give it a try at home, though. Five hours, eighteen minutes and thirty-three seconds to go…
Garrett Albright
I've been looking for something like this on Mac OS X.
Devon
Okay, this is pretty epic. I'm going to have to insist to my boss that I install PHP 5 (and 10.5) on my machine at work so I can use this. Mad props, Brian.
Garrett Albright
This has a TON of frustrating bugs on PHP 5.3.3 w/ Xdebug 2.1.0. The author seems nonresponsive. It's unusable for all but the most trivial of debugging.
hobodave
A: 

I debug PHP CLI scripts and web probject (thru apache etc) using Eclipse & ZendDebugger all the time.

I answered a similar question over at the following link: click here

Hopefully that's what you're looking for.

arin sarkissian
A: 

Here's how I did it:

1 - Copy the latest version of xdebug.so from http://aspn.activestate.com/ASPN/Downloads/Komodo/RemoteDebugging to /usr/libexec.

2 - Add the following to the global php.ini:

zend_extension="/usr/libexec/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1

3 - Restart Apache and run MacGDBp.

Luke Dennis
A: 

I've got it working on my local setup. I posted directions on my blog:

http://littleblackhat.com/blog/?p=12

A: 

I use Komodo 5 --- debugging works wonderfully, not only with PHP, but also with Ruby and Python. I 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!

David