Eclipse PDT将项目名称添加到虚拟主机路径

Can someone help me out. I run into a problem when I run a file (e.g. index.php). Every time when I want to run a file on the test server (XAMPP) Eclipse (PDT) adds the project name (e.g. testproject) after the server name (e.g. http://testproject.dev). Because I have setup a virtual host setup to automatically use a specific path (e.g. http://testproject.dev is linked to http://localhost/testproject) on the server this creates a problem. Eclipse adds the project name and then the URL becomes http://testproject.dev/testproject/index.php.

This are my configurations:

XAMPP httpd.conf (c:\xampp\conf\httpd.conf)

# Virtual hosts
Include "conf/extra/httpd-vhosts.conf"

httpd-vhosts.conf (c:\xampp\conf\extra\httpd-vhosts.conf)

NameVirtualHost 127.0.0.1

<VirtualHost 127.0.0.1>
DocumentRoot "C:/xampp/htdocs/testproject"
ServerName testproject.dev
</VirtualHost>

Windows 7 Windows vhost file (C:\Windows\System32\drivers\etc\hosts)

127.0.0.1 testproject.dev

Eclipse -> Preferences -> PHP Server

  • Tab "Server": Name: "Development_Server_Testproject" URL: http://testproject.dev

  • Tab "Path Mapping": Path on server http://testproject.dev Path in workspace

/testproject

I had a same issue with a Lamp dev server.
It appears ridicolous but I think your problem is about the size of a window in eclipse that doesn't show all the informations.

Try this:

  • In the tab "Path Mapping" remove the line you add
  • Go to "debug configuration" in Eclipse. On the left, expand the "PHP Web configuration" link.
  • Select the debug configuration you want to use for your project or create one if you haven't already done it.
  • Select your correct php server in the drop down menu.
  • Under the page there is a checkbox for url named "Auto generate". You have to uncheck it.
  • Under the checkbox there is a textbox to specify the url. If you didn't see it, resize your "Debug configuration" window! I spent a lot of time searching for the right options and I found that the problem is only the window size that isn't enought large to show them!
  • In the first part of the textbox now you would have http://testproject.dev, in the second part of the textbox you have /testproject/index.php. Clear the textbox.
  • You are done! Debug and enjoy.

Hope this help

Marco - Reteidee