• Share this article:

PHPEclipse and XAMPP

Sunday, September 25, 2005 - 16:05 by Wayne Beaton

At the Eclipse Foundation, we tend to eat our own dog food. Foundation employees use Eclipse itself to generate content for the website (I can’t speak for individual project teams, but I’m pretty sure that most of them do as well). In particular, we use PHPEclipse to create and edit most of the content (which makes pretty heavy use of PHP). I’ve just recently started using the 1.1.7 version which prereqs the web tools project. All-in-all, it’s pretty cool stuff.

One of the neater features of PHPEclipse is integration with XAMPP. XAMPP is a distribution of several open source products including Apache HTTP Server with PHP support and MySQL; it’s a one-click (more or less) install of a collection of key products for testing web applications. Essentially, you configure the Apache installation within XAMPP to have its DocumentRoot point at your workspace and Apache will serve up whatever you’ve got saved there. PHPEclipse provides a view with a browser that automatically updates whenever you save a PHP file you’re editing. It also works for HTML files. It’s not quite a WYSIWYG editor, but it’s the next best thing (you edit in HTML and the view shows you what it’s going to look like). You can even test database interaction by configuring MySQL.

PHPEclipse even provides some handy buttons in the toolbar to start and stop the XAMPP package with a single click.

There is an unfortunate security hole in setting this up. By configuring Apache to serve content from your Eclipse workspace, you are essentially making public anything you have loaded there. It might make sense to keep a separate workspace (or perhaps a separate directory with the web projects) for your web content. On the plus side, Apache is by default configured not to serve up directory listings so anybody who wants to peek at your workspace contents is not going to have a super easy time of it. I’ve been toying with sorting out how to prevent Apache from serving content to anybody but localhost; I’m pretty sure this is possible, but have never tried to make it happen.

Anyway, the combination of PHPEclipse, Web Tools, and XAMPP is pretty cool.