I like Eclipse. It’s my main Java development tool, and I use it quite extensively for php as well. Mostly I’ve been using PHPEclipse, but it’s just not stopping on breakpoints placed on web server scripts. I gave Zend’s Eclipse PHP platform a shot as well, with the same results.
At this point I’m beginning to think that it’s something with my box.
An article on Sherlock Web suggests there might be some problem with the debugger on Intel Macs, and lo and behold, that’s exactly what I’m using. Awesome. However, after much trial and error I was able to find that if I moved my files under /Library/WebServer/Documents instead of symlinking to the directory, then the debugger did recognize breakpoints properly. This lead me to believe that the symlink was confusing the path, so I just created a VirtualHost whose document root points to the exact same directory Eclipse is getting its stuff from.
No dice.
I just started trying out Zend Studio which behaves better (breakpoint-wise) but seems to have a few peculiarities, such as an inability to find include files which are referenced via relative paths, plus a rather unorthodox user interface. On the plus side, if I load the environment and then invoke the debugger via Zend’s Firefox toolbar things work as they should.
I’m pretty much done fiddling with all this crap, and will run a heterogeneous environment until I’m done with my current php project. I’m not sure if it’s a Mac issue of a PHP issue, but my next step will probably be installing everything on a CentOs server and attempting to debug from my machine.
Meanwhile, any pointers you have are welcome.
PS: I’m using Marc Liyanage’s PHP packages for Mac. If you’re thinking of using PHP, save yourself a few headaches and just go for them.
UPDATE: Blessed be Nyarlathotep! I’ve figured it out. It not only wants the files to be on an actual path - i.e., no symlinking - but for server directories to have the same structure as your folders on the Eclipse project.
I’m I making sense? Here’s a better explanation. It works with Eclipse and Zend’s PDT, but the instructions might help you with PHPEclipse as well.
Suppose you have a php project in Eclipse called MyPHPProject, with the following structure:
MyPHPProject
database
some.sql
docs
doc1.txt
doc2.txt
php
index.php
and.php
all.php
your.php
other.php
web.php
pages.php
You should create a virtual host called something like mytestserver, and add the name to your hosts file.
<VirtualHost 127.0.0.1:80>
DocumentRoot "/Users/youruser/Sources/myphpproject"
ServerName mytestserver
<Directory "/Users/youruser/Sources/myphpproject">
allow from all
Options +Indexes FollowSymLinks MultiViews
</Directory>
</VirtualHost>
Notice that I’m not linking the document root directly to the php directory - that’s what killed all this hours of figuring it out for me. You need to maintain the same structure as the project you have on Eclipse.
When you create the PHP Web Page debug instance, set the parameters as follows:
- File / Project:
myphpproject/php/index.php - Leave Publish files to server unchecked.
- Uncheck Auto Generate, and set it to
http://mytestserver/php/index.php
Alternatively you could define (on the same window) a server called mytestserver that has http://mytestserver as the base path and save you that last step.
Set a couple breakpoints, debug and voilá! They now work.
[...] out the way OS X is still Unix underneath, but behaves slightly but annoyingly differently when debugging php pages or getting Redland to [...]
[...] Programming It’s the revenge of PHP debugging: for some reason breakpoints just stopped working on my Eclipse PHP IDE. This is apparently a known [...]