5

Eclipse PDT is very slick, but here's my issue, Re: Launcher (run configurations)

I'm trying to keep things very clean, concise on my local machine (with WAMP stack) and I have a number of virtual hosts configured, that keep my URL's easy to use.
In eclipse, I set up PHP servers to correspond with these Vhosts.

Since I have existing code, I'm usually setting up a new project 'from existing sources'.
Then when I try to 'run', I get URL auto-generated like this; with the Project name in it: http://MyVhost/MyProj/testing.php

And what I really want is: http://MyVhost/testing.php

I find myself doing a lot of editing and adjusting of the servers and run configurations, before I can get the URL that works. Any recommendations ?

Robert
  • 61
  • 1
  • 4
  • In my answer below, I explain how `/MyProj` , the project name, can be set to `/` in the autogenerated URL. Since the OP seems to use the document root as the project location, it will work. I still feel that I am missing something because it is not natural to me to always do that. –  Nov 29 '15 at 05:21

4 Answers4

0

You can modify the org.eclipse.php.server.ui plugin to get it the way you want.

Use the Plugin devlopment perspective of Eclipse to modify the plugin. The dialogs are available in

  • /org.eclipse.php.server.ui/src/org/eclipse/php/internal/server/ui/launching/PHPWebPageLaunchShortcut.java
  • /org.eclipse.php.server.ui/src/org/eclipse/php/internal/server/ui/ServerLaunchConfigurationTab.java

Animation showing Java files that need to be modified in the PDT plugin JAR https://vsubhash.wordpress.com/2013/01/26/fix-for-url-auto-generate-bug-in-eclipse-php-pdt-plugin/

The Somberi
  • 126
  • 3
0

The path part of the autogenerated URL is the Base Path (which defaults to / + project name) + the path of the file inside the project location. You can set the Base Path to / in Project | Properties | Debug . It applies to Run configurations as well. If you always use the documentroot of the site as the project location, it will work.

0

I ran across something similar where if I had a vhost named "test" I wanted to run everything for that project as...

http://test/<whatever_else>/

Here is my 3 step how-to to solve it, though I am not sure of any unintended consequences other than zend debugger not working.

  1. From Eclipse, go to Windows/Preferences
  2. Go to PHP/PHP Servers
  3. Change Default PHP Web Server from http://localhost to http:/

The project will append the second slash and your project name if you just let it auto-generate.

Hope that helps someone. Helped me a ton.

Dave
  • 11
  • 2
0

You can create a new Run Configuration Run->Run Configurations and as long as you have setup your virtual hots as servers, you can untick 'Auto Generate' option under URL and enter you URL manually for each project. So even if you point to different files in your project, it won't matter because Eclipse will use your manually entered URL. Save these and then you're done!

JohnP
  • 49,507
  • 13
  • 108
  • 140
  • But the question was about how to fix Auto Generate, so this haven't answered the question. – ddekany Jul 04 '11 at 10:11
  • Once you create your set of servers, autogenerate isn't needed because you can simply leave the url part of it empty. – JohnP Jul 04 '11 at 10:36