帮助为 Eclipse 设置 php
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/238451/
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
Help setting up php for Eclipse
提问by NotDan
I'm trying to set up Eclipse for php web development. What I would like to do is preview a php web page from within Eclipse, but I cannot figure out how to do this. Is there an integrated web server of some sort that allows this, or do I have to set up IIS/Apache to do it? If so, do I have to have my php files in the web servers path, or does Eclipse auto deploy the files to the local web server? Any information or links would be very much appreciated.
我正在尝试为 php web 开发设置 Eclipse。我想做的是从 Eclipse 中预览一个 php 网页,但我不知道如何做到这一点。是否有某种类型的集成 Web 服务器允许这样做,或者我是否必须设置 IIS/Apache 才能做到这一点?如果是这样,我是否必须将我的 php 文件放在 web 服务器路径中,或者 Eclipse 是否自动将文件部署到本地 web 服务器?任何信息或链接将不胜感激。
回答by Josh Sandlin
There is a plugin for Eclipse called PDT which makes PHP development a breeze.
Eclipse 有一个名为 PDT 的插件,它使 PHP 开发变得轻而易举。
For an overview on how to install it, you can refer to the Eclipse website:
有关如何安装它的概述,您可以参考 Eclipse 网站:
http://wiki.eclipse.org/PDT/Installation#Eclipse_3.4_.2F_Ganymede_.2F_PDT_2.0
http://wiki.eclipse.org/PDT/Installation#Eclipse_3.4_.2F_Ganymede_.2F_PDT_2.0
To actually view the PHP scripts running, I would imagine that you'd have to have some sort of server already installed and running. You could probably set the workspace location to be in the server path, and then view the files through localhost. But maybe the PDT package takes care of some of that for you.
要实际查看运行的 PHP 脚本,我想您必须已经安装并运行某种服务器。您可以将工作区位置设置在服务器路径中,然后通过 localhost 查看文件。但也许 PDT 包会为您处理其中的一些问题。
回答by star18bit
I will make it Very Easy ;)
我会让它很容易;)
(1) Go to Eclipse home: http://www.eclipse.org/downloads/and download Eclipse Classic (Current May/2013 version is 4.2.2)
(1) 进入 Eclipse 主页:http: //www.eclipse.org/downloads/并下载 Eclipse Classic(当前 May/2013 版本为 4.2.2)
(2) One you have eclipse fired-up in you machine Do followings : Help > Install Software
(2) 在你的机器上启动了 eclipse 执行以下操作:帮助 > 安装软件


Than, Click On Add 
比,点击添加 
Finally, Add this link: http://download.eclipse.org/releases/indigofor all the list of Add-Ons 
最后,添加此链接:http: //download.eclipse.org/releases/indigo以获取所有附加组件列表
and pick PHP under Web Addon (Should be last in the list) and Install it.
并在 Web Addon 下选择 PHP(应该在列表中的最后一个)并安装它。
Restart you eclipse + thumbs-up to my Ans. and Start Coding ;)
重新启动你的日食 + 对我的 Ans 竖起大拇指。并开始编码;)
回答by acrosman
I setup apache/php/MySQL on my windows PC, so that testing environment is not totally unlike my servers (excepting the OS, but 90% of the time that's okay). I create alias's in the Apache configuration to the Eclipse workspace, and just hop between the browser and eclipse. The URL for testing is something like:
我在 Windows PC 上设置了 apache/php/MySQL,因此测试环境与我的服务器并不完全不同(操作系统除外,但 90% 的时间都可以)。我在 Apache 配置中为 Eclipse 工作区创建别名,然后在浏览器和 eclipse 之间跳转。用于测试的 URL 类似于:
http://localhost/project_name/file.php
While this isn't ideal, it is a fairly consistent/smooth process that doesn't require a great deal of configuration within Eclipse. I keep thinking there should be a better way, but I honestly don't think I'm burning enough time to justify the research. Once the setup is done, I don't really loose more time after that, and I can control which version of PHP I'm running on my system.
虽然这并不理想,但它是一个相当一致/平稳的过程,不需要在 Eclipse 中进行大量配置。我一直认为应该有更好的方法,但老实说,我认为我没有花足够的时间来证明研究的合理性。设置完成后,我就不会再浪费时间了,而且我可以控制在我的系统上运行的 PHP 版本。
I don't tend to like integrated browsers for testing of web applications anyway. Every time I've dealt with one, it was completely different from a "real" browser that I had to completely retest anyway. At least this way, I have my Firefox testing done when I'm through the first pass of the logic.
无论如何,我不喜欢使用集成浏览器来测试 Web 应用程序。每次我处理一个时,它都与我必须完全重新测试的“真实”浏览器完全不同。至少这样,当我通过逻辑的第一遍时,我已经完成了我的 Firefox 测试。
回答by Luis Melgratti
try easyeclipse, it the easiest Eclipse setup i've found
尝试easyeclipse,这是我发现的最简单的 Eclipse 设置
"EasyEclipse for LAMP: For PHP, Python, Perl, and Ruby development with a web server and a database"
“EasyEclipse for LAMP:用于带有 Web 服务器和数据库的 PHP、Python、Perl 和 Ruby 开发”
回答by Caltor
I would also recommend downloading and installing WAMP server which is a really easy all in one Windows equivalent (windows, Apache, MySQL, PHP) of what you are likely to have with a commercial web host. See http://www.wampserver.comfor details and download.
我还建议下载和安装 WAMP 服务器,这是一个非常简单的 Windows 等效(Windows、Apache、MySQL、PHP)服务器,您可能会使用商业网络主机。有关详细信息和下载,请访问 http://www.wampserver.com。
As well as pdt which had already been mentioned other alternatives are phpeclipse and aptana studio which is based on eclipse.
除了已经提到的 pdt 之外,其他替代方案还有基于 eclipse 的 phpeclipse 和 aptana studio。
回答by user3430128
Visit this website https://eclipse.org/pdt/. Go to where it says 'Update existing Eclipse'.
访问此网站https://eclipse.org/pdt/。转到显示“更新现有 Eclipse”的位置。
The procedure is this "In Eclipse, click Help -> Install New Software and work with *: http://download.eclipse.org/tools/pdt/updates/3.6"
过程是这样的“在Eclipse中,单击帮助->安装新软件并使用*:http: //download.eclipse.org/tools/pdt/updates/3.6”

