Norman's notes on Eclipse+XAMPP in OS X

Contents

Some comments on installing Eclipse Classic + Modules + XAMPP on OS X

Warning: these notes are more of a running dialog with myself as I try to get this up and running. It exposes many internal details of how I go about installing software. It is not pretty.

Platform: OS X.4.10, Developer tools installed. I am working from a fresh user account that has no administrative privileges.


Eclipse Classic + Modules + XAMPP

Eclipse:

Downloaded Eclipse classic; the actual file is eclipse-SDK-3.3.1-macosx-carbon.tar. Unpacking is no problem---the file unpacks into a directory called 'eclipse' containing the Eclipse program (and other stuff). No permission needed, Eclipse at least starts up just fine.

XAMPP:

Downloaded XAMPP from Sourceforge; the actual file is xampp-macosx-0.6.3.dmg. Opening mounts the expected disk image with XAMPP MacOS X 0.6.3.pkg. The package isntaller does not allow one to choose the install location---it installs only as a subdirectory of /Applications. And this is likely to require an administrative password. However, I now notice that one can allegedly download the tarball instead and unpack where one desires---I will try this out sometime later.

I also note that XAMPP appears to only be available in pre-compiled form for Intel. That may be an issue for the workshop.

PhpEclipse:

The instructions are fine almost all the way through. But after agreeing to the license, I get a screen indicating where the public will be installed. I just accept the default and select "Finish". Now the plugin is downloaded and I get the message that it is unsigned.

Tying the PhP plugin to XAMPP:

On OS X, "Preferences" is located under the Eclipse menu.

Now, alas, things start falling apart. I do not appear to have the xampp_start and xampp_stop programs on OS X. I am guessing this is somehow handled by the XAMPP Control Panel. This will take some finding of documentation for XAMPP under OS X.

A bit of poking around indicates that one starts and stops xampp with the 'mampp start' and 'mampp stop', so I use the following for the XAMPP preferences, based on my having installed XAMPP in /Applications/xampp:

  • XAMPP Start: /Applications/xampp/xamppfiles/mampp start
  • XAMPP Stop: /Applications/xampp/xamppfiles/mampp stop

OK, installing into a password-protected directory like /Applications is a pain, because we need to edit http.conf, which means we need the password again,... So I will go the tarball approach and install XAMPP in the user account.

Needless to say, for the workshop we would have all this prepared for the participants.

OK, returning to the tarball approach:

  • I create a directory called H-FOSS for all applications.
  • Move the eclipse folder into H-FOSS.
  • Unpack xampp-macosx-0.6.3.tar in H-FOSS; this creates a subdirectory Applications. Move Applications/xampp to top-level of H-FOSS.
  • Eclipse preferences: XAMPP Start/Stop as above, now pointing to H-FOSS/xampp instead of /Applications/xampp.
  • httpd.conf: DocumentRoot and Directory directives set to /Users/hfoss/Documents/workspace (my eclipse workspace).

And now we try to get things started:

  • Start XAMPP with the toolbar button. No complaints anywhere, but no confirmation that anything is working, either.
  • Make a trivial PHP project: index.php contains just <?php echo 'Hello World!'; ?>.

No success: PHP browser just seems to search forever trying to invoke http://localhost/TestPHPProject/index.php. This is almost certainly because there is not actually any web browser running---there is certainly no indication of such in the process list.

Argghhh! Trying to fire up the XAMPP control panel, I get an error message: XAMPP *must* be installed in /Applications. That totally sucks.

OK, we'll move XAMPP into /Applications, change XAMPP Start/Stop accordingly. I remain completely unsurprised that no web server is running. And I find it annoying that it is not possible to stop the PHP Browser from attempting to load my test page without quitting Eclipse.

We turn to the Control Panel in /Applications/xampp. Fire it up, provide an administrator password, and get a not-very-well-designed panel for starting the XAMPP components. Click on the "Start" button for "All Components," get told that File permissions are being checked...this may take awhile. No interface to indicate whether anything is going on. But somewhat hopefully, there is an xampp process running---and hey! Now messages appearing indicating that the various components have been fired up. This took about 60 seconds with no feedback at all. Ugh.

Back to Eclipse: since I started XAMPP from the XAMPP Control Panel, I will try my PHP test page without starting XAMPP from the Eclipse toolbar first.

Good sign: I don't have permission to access /TestPHPProject/index.php! Good sign, because that says that the web server is running, just not correctly configured.

Must debug the web server, and that requires authentication, and this is getting really annoying, and it is lunch time. Will probably not finish this by class time today...

OK, for now I am bagging this particular approach. I see many issues to resolve, which may all be resolved just by using EasyEclipse. A few things I can think of:

  • Users will need administrative privileges. I don't actually think this is a serious problem, but maybe others disagree.
  • XAMPP only has pre-compiled binaries for Intel---not so good.
  • XAMPP must be installed in /Applications in order to run, which prevents us from providing a simple disk image (.dmg) that contains pre-configured binaries.
  • So far I can only get XAMPP servers to run from the XAMPP control panel. Specifically, I cannot get it to run using the Eclipse-provided toolbar buttons. Again maybe not a disaster, but it would really be preferable to have the exact same usage instructions for all workshop participants, regardless of platform.

More contemplation on XAMPP:

It will not be easy to make XAMPP relocatable to any directory other than /Applications. The authors have done a good job of hardcoding that path in many many places. So far I've only looked at the start/stop and permissions-fixing shell scripts. I could probably fix those, but it is not clear that I should. So I will continue to work with having it installed in /Applicaitons.

Woohoo! Fixed the permissions problems. Turns out that the default workspace for Eclipse is located in the user's Documents directory. And by default, the Documents directory is accessible only to the owner (as it should be). But that, of course, means that the web server cannot look inside it (remember, apache is running as nobody, not as root). And so, another annoyance. I can now bring up my "Hello world" PHP document inside Safari.

Now let's try from Eclipse....It works! I.e., opening my TestPHPProject and running index.php from the PHP browser does indeed seem to run the document.

Now we normally think of starting XAMPP from the Eclipse toolbar. By default this does not work, because the script that this starts insists on being run as root. It would seem that setting the script to run setuid ought to do the job, although that is really a bad idea. But in fact, it still does not work---I don't know what is going on here, but for some reason the effective user id on a setuid-root script is still the real user id of the user running the script. But given that it is such a bad idea, I'd have to argue for starting from the supplied control panel---yet another instruction that is different for Mac users than for Windows and Linux users. Bleah.

OK, I think I see how to assemble a distribution that uses Eclipse Classic + PHPEclipse + XAMPP. Will do it maybe Friday.

EasyEclipse

Download EasyEclipse for LAMP from http://www.easyeclipse.org/site/distributions/index.html.

I hate these people.

Unlike EclipseClassic, which just downloads as a binary, EasyEclipse insists on an install program. I'm not so sure where it will install, and I do not really want to blow away my existing Eclipse software (which I use for other development), which I'm afraid is exactly what this install program will do.

Pisses me off.

Installs into /Applications, but at least it does not appear to destroy my existing installation. And seems to start fine when copied out of /Applications into a user folder.

But still wants XAMPP. For some reason I had been hoping that EasyEclipse came with a built-in web server etc. so as to avoid this.