Eclipse 输出到 WAMP 网络服务器 www 文件夹
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3482222/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Eclipse output to WAMP webserver www folder
提问by Aishwar
I have an eclipse workspace folder. I want to store all the different projects I am working on over here. Now I am working on a PHP project and have WAMP installed. Is there some way to configure eclipse such that it outputs my project files to the server's www folder.
我有一个 eclipse 工作区文件夹。我想在这里存储我正在处理的所有不同项目。现在我正在处理一个 PHP 项目并安装了 WAMP。是否有某种方法可以配置 Eclipse,以便将我的项目文件输出到服务器的 www 文件夹。
I don't want to create my workspace in the server's www folder, for the following reasons: - I will work on multiple projects over time and I want all of them to reside in the same workspace - I don't want to pollute the web server's www folder (though this is a development machine). I feel that if I have the code in a separate workspace, there is a low chance of me deleting it by mistake. I don't want to end up deciding to clean the www folder and deleting my only copy of the code!
我不想在服务器的 www 文件夹中创建我的工作区,原因如下: - 随着时间的推移,我将处理多个项目,并且我希望它们都驻留在同一个工作区中 - 我不想污染Web 服务器的 www 文件夹(尽管这是一台开发机器)。我觉得如果我将代码放在单独的工作区中,我错误地删除它的可能性很小。我不想最终决定清理 www 文件夹并删除我唯一的代码副本!
Any alternative solutions to my concern are also welcome :)
也欢迎任何解决我问题的替代解决方案:)
采纳答案by naiquevin
You can keep the php code in your current eclipse workspace and then create virtual host in the httpd.conf file of apache server with document root pointing to this directory.
您可以将 php 代码保留在您当前的 eclipse 工作区中,然后在 apache 服务器的 httpd.conf 文件中创建虚拟主机,文档根指向该目录。
回答by cpowel2
You don't need to edit any php.ini files or anything crazy like that; you just need to change a couple of things in Eclipse.
你不需要编辑任何 php.ini 文件或任何类似的东西;您只需要在 Eclipse 中更改一些内容。
Step #1: Go into Eclipse and click on Window --> Preferences --> PHP --> PHP Servers
第 1 步:进入 Eclipse 并点击 Window --> Preferences --> PHP --> PHP Servers
There should be a default server listed; you can edit it or just create a new one(this is what I did) and just set it as default later.
应该列出一个默认服务器;你可以编辑它或者只是创建一个新的(这就是我所做的),然后将其设置为默认值。
Click add or new or whatever it will come up with 2 boxes. The first is just what you want to call the server; call it whatever you like. The second is IMPORTANT -- this is where the www folder for your WAMP server is located. I have a shortcut to it on my desktop with a folder with all my php files in it. I just typed localhost/name of my folder <--- your folder goes here.
单击添加或新建或任何会出现 2 个框的内容。第一个就是您要调用的服务器;你喜欢怎么称呼它。第二个是重要的——这是 WAMP 服务器的 www 文件夹所在的位置。我的桌面上有一个快捷方式,其中有一个文件夹,其中包含我所有的 php 文件。我刚刚输入了我的文件夹的 localhost/名称 <--- 你的文件夹放在这里。
It should be localhost/wamp/www if you don't have a shortcut. Don't hold me to that, though.
如果没有快捷方式,它应该是 localhost/wamp/www。不过,不要让我坚持这一点。
Step #2 : Running the program
第 2 步:运行程序
When you have your php file you want to run, right click it and select Run as --> Run Configurations --> PHP webpage(double click). In the "File" area click Browse. Your project folder with your .php file you want to run should pop right up. If not, you'll have to look for it. Select it, then click "Run". Eclipse will open its default browser, and if all went well, you should be able to see your output.
当您有要运行的 php 文件时,右键单击它并选择运行方式 --> 运行配置 --> PHP 网页(双击)。在“文件”区域中单击浏览。包含要运行的 .php 文件的项目文件夹应该会立即弹出。如果没有,您将不得不寻找它。选择它,然后单击“运行”。Eclipse 将打开其默认浏览器,如果一切顺利,您应该能够看到您的输出。
It probably makes it easier if you just use a separate workspace for your PHP projects and store all the files in the www folder(Eclipse should make sub folders for new projects).
如果您只为 PHP 项目使用单独的工作区并将所有文件存储在 www 文件夹中(Eclipse 应该为新项目创建子文件夹),这可能会更容易。
Hope this helps
希望这可以帮助
回答by Terry Torres
Only solution I found was to place your PHPfiles under the wamp\wwwfolder.
我找到的唯一解决方案是将您的PHP文件放在wamp\www文件夹下。
Example:
例子:
c:\wamp\www\yourproject\index.php
c:\wamp\www\yourproject\index.php