views:

21

answers:

1

I am using Eclipse PDT with the Zend community server to develop PHP.

If I write some code and hit Run As...PHP Web Page, I get "Page cannot be found". This makes sense since my workspace is off in my documents folder, not in the Zend/Apache's htdocs tree.

So one option would be to move my workspace to a folder under the Apache htdocs. But that just seems wrong ;-) Also, I keep my workspace in a Dropbox folder.

Is there an alternative directive/configuration setting for Eclipse PDT that says "when I say Run or Build, I want you to copy the project to folder X and run it as a web page from there". Or perhaps something else I'm missing about Eclipse PDT?

A: 

I found a method, using Ant: http://www.tellingmachine.com/post/Configuring-Eclipse-PDT-to-work-with-Ant-build-tasks.aspx

Here is my method for developing PHP on Windows in Eclipse:

  1. Download the Zend all-in-one Eclipse environment
  2. Download the Zend Server CE
  3. Install Zend into someplace like c:\Zend. If you put it in Program Files, you'll need to do extra security configuration or else your build directives will fail.
  4. Using the link above to setup Ant and a build directive
  5. Wah-lah. You can setup a Run Configuration and then Run As... and view your php script in a web browser.

You could also use the stock Eclipse PDT and WAMP and achieve the same effect. The key is (1) putting your htdocs outside of Program Files, and (2) using Ant to automate the build copy.

raindog