Mac Eclipse Setup

Having successfully resolved my PHP, phpMyAdmin and MySQL issues, I next turned to the task of getting the Eclipse software development environment up and running on my Mac.

I started with the latest version, one that’s pre-loaded with the most needed bells and whistles: Eclipse IDE for Java EE Developers.

Note I said “most needed.” There were a couple of add-ons I needed to install; one worked without a hitch, and the other prompted this posting!

As detailed below, I had no problems with the subversion plugin. On the other hand, it was non-obvious how to configure the system in order to be able to edit and debug PHP projects; hopefully my notes below will be of some help to others trying to perform the same setup.

Subversion Access

To access subversion repositories from within the Eclipse IDE an appropriate plugin must be installed. There are 2 choices, Subclipse and Subversive. Subclipse has been around longer and is brought to you by the same folks as subversion itself. On the other hand, subversive is now an official Eclipse project.

In the course of my testing I installed both without any problems. You’ll have to do some googling to determine which one best meets your needs.

PHP Debugger

Like all problems, once understood the solution seems relatively simple. That’s how it was in terms of getting PHP editing and debugging working in Eclipse.

I had installed the necessary components to edit and debug PHP code using Eclipse and PDT, but kept getting an error saying I needed to configure the debugger in php.ini. I had already done this, and so was quite puzzled.

As it turns out, on Mac OS X Leopard, the Zend PHP debugger will only work with a 32-bit version of Apache; by default Mac OS X uses a 64-bit version.

Extracting this version from the universal binary that comes with the Mac is relatively easy (thanks to John Malis for this idea):

# back up current version
sudo cp httpd httpd.uni

# extract 32 bit version
sudo lipo httpd -thin i386 -output httpd.i386 # Intel

# Copy to httpd
sudo cp httpd.i386 httpd # Intel

Keep in mind that your newly liposuctioned httpd may be overwritten by OS X updates.

Once that was done, I could see from the PHP status page that the Zend debugger was installed.

But I was still not out of the woods. When calling PHP directly from the command line, it was clear the Zend module wasn’t loading:

# php -m
Failed loading /usr/local/php5/lib/php/extensions/ZendDebugger.so:  (null)

After scratching my head a bit, I decided that the problem with php was the same as with Apache.

So, I did a similiar “lipo” operation as on the Apache binary, and finally everything worked as expected.

# back up current version
sudo cp php php.uni

# extract 32 bit version
sudo lipo php -thin i386 -output php.i386 # Intel

# Copy to httpd
sudo cp php.i386 php # Intel

Keep in mind that your newly liposuctioned php may be overwritten when you update your PHP installation.

Thanks to everyone who posted about their experiences; they really helped me to get PHP editing and debugging working using Eclipse on my Mac!

Reference

Directions for enabling PDT within Eclipse (scroll down to “From Update Site” heading):

http://wiki.eclipse.org/PDT/Installation

Instructions for enabling and configuring PHP debugging:

http://www.eclipse.org/pdt/articles/debugger/os-php-eclipse-pdt-debug-pdf.pdf

The server component for PHP debugging is downloadable from here:

http://downloads.zend.com/pdt/server-debugger/

2 thoughts on “Mac Eclipse Setup”

  1. I’ve approved your comment, including the link.

    I should note for other readers that despite the mention of OS X, the linked article appears to be about Zend on Ubuntu.

    I say appears, as the article is written in Spanish …

Comments are closed.