views:

2072

answers:

3

I'm trying to set up Eclipse for php web development. What I would like to do is preview a php web page from within Eclipse, but I cannot figure out how to do this. Is there an integrated web server of some sort that allows this, or do I have to set up IIS/Apache to do it? If so, do I have to have my php files in the web servers path, or does Eclipse auto deploy the files to the local web server? Any information or links would be very much appreciated.

+3  A: 

There is a plugin for Eclipse called PDT which makes PHP development a breeze.

For an overview on how to install it, you can refer to the Eclipse website:

http://wiki.eclipse.org/PDT/Installation#Eclipse_3.4_.2F_Ganymede_.2F_PDT_2.0

To actually view the PHP scripts running, I would imagine that you'd have to have some sort of server already installed and running. You could probably set the workspace location to be in the server path, and then view the files through localhost. But maybe the PDT package takes care of some of that for you.

Josh Sandlin
+2  A: 

I setup apache/php/MySQL on my windows PC, so that testing environment is not totally unlike my servers (excepting the OS, but 90% of the time that's okay). I create alias's in the Apache configuration to the Eclipse workspace, and just hop between the browser and eclipse. The URL for testing is something like:

http://localhost/project_name/file.php

While this isn't ideal, it is a fairly consistent/smooth process that doesn't require a great deal of configuration within Eclipse. I keep thinking there should be a better way, but I honestly don't think I'm burning enough time to justify the research. Once the setup is done, I don't really loose more time after that, and I can control which version of PHP I'm running on my system.

I don't tend to like integrated browsers for testing of web applications anyway. Every time I've dealt with one, it was completely different from a "real" browser that I had to completely retest anyway. At least this way, I have my Firefox testing done when I'm through the first pass of the logic.

acrosman
+2  A: 

try easyeclipse, it the easiest Eclipse setup i've found

"EasyEclipse for LAMP: For PHP, Python, Perl, and Ruby development with a web server and a database"

Luis Melgratti