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

时间:2023-01-17 20:58:56

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.

有人可以帮我吗。我运行文件时遇到问题(例如index.php)。每次当我想在测试服务器(XAMPP)上运行文件时,Eclipse(PDT)会在服务器名称之后添加项目名称(例如testproject)(例如http://testproject.dev)。因为我已经设置了一个虚拟主机设置来自动使用服务器上的特定路径(例如http://testproject.dev链接到http:// localhost / testproject),这会产生问题。 Eclipse添加项目名称,然后URL变为http://testproject.dev/testproject/index.php。

This are my configurations:

这是我的配置:

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

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)

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)

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

127.0.0.1 testproject.dev

Eclipse -> Preferences -> PHP Server

Eclipse - > Preferences - > PHP Server

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

    选项卡“服务器”:名称:“Development_Server_Testproject”URL:http://testproject.dev

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

    选项卡“路径映射”:服务器上的路径http://testproject.dev工作空间中的路径

/testproject

/ testproject

1 个解决方案

#1


0  

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.

我与Lamp dev服务器有同样的问题。它似乎很荒谬,但我认为你的问题是关于eclipse窗口的大小,并没有显示所有的信息。

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.
  • 转到Eclipse中的“调试配置”。在左侧,展开“PHP Web配置”链接。
  • 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.
  • 在下拉菜单中选择正确的php服务器。
  • Under the page there is a checkbox for url named "Auto generate". You have to uncheck it.
  • 在页面下方有一个名为“自动生成”的url复选框。你必须取消选中它。
  • 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.
  • 在文本框的第一部分,现在你将拥有http://testproject.dev,在文本框的第二部分你有/testproject/index.php。清除文本框。
  • You are done! Debug and enjoy.
  • 你完成了!调试和享受。

Hope this help

希望这有帮助

Marco - Reteidee

Marco - Reteidee

#1


0  

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.

我与Lamp dev服务器有同样的问题。它似乎很荒谬,但我认为你的问题是关于eclipse窗口的大小,并没有显示所有的信息。

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.
  • 转到Eclipse中的“调试配置”。在左侧,展开“PHP Web配置”链接。
  • 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.
  • 在下拉菜单中选择正确的php服务器。
  • Under the page there is a checkbox for url named "Auto generate". You have to uncheck it.
  • 在页面下方有一个名为“自动生成”的url复选框。你必须取消选中它。
  • 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.
  • 在文本框的第一部分,现在你将拥有http://testproject.dev,在文本框的第二部分你有/testproject/index.php。清除文本框。
  • You are done! Debug and enjoy.
  • 你完成了!调试和享受。

Hope this help

希望这有帮助

Marco - Reteidee

Marco - Reteidee