简体   繁体   English

帮助为Eclipse设置php

[英]Help setting up php for Eclipse

I'm trying to set up Eclipse for php web development. 我正在尝试为php web开发设置Eclipse。 What I would like to do is preview a php web page from within Eclipse, but I cannot figure out how to do this. 我想做的是从Eclipse中预览一个php网页,但我无法弄清楚如何做到这一点。 Is there an integrated web server of some sort that allows this, or do I have to set up IIS/Apache to do it? 是否有某种集成的Web服务器允许这样做,或者我是否必须设置IIS / Apache才能执行此操作? 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? 如果是这样,我是否必须将我的php文件放在Web服务器路径中,或者Eclipse是否自动将文件部署到本地Web服务器? Any information or links would be very much appreciated. 任何信息或链接将非常感谢。

There is a plugin for Eclipse called PDT which makes PHP development a breeze. 有一个名为PDT的Eclipse插件,它使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. 要实际查看正在运行的PHP脚本,我想你必须安装并运行某种服务器。 You could probably set the workspace location to be in the server path, and then view the files through localhost. 您可以将工作空间位置设置为服务器路径,然后通过localhost查看文件。 But maybe the PDT package takes care of some of that for you. 但也许PDT包可以为你解决一些问题。

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(Current May / 2013版本为4.2.2)

(2) One you have eclipse fired-up in you machine Do followings : Help > Install Software (2)你在机器中发射的日食如下:帮助>安装软件

帮助>安装软件

Than, Click On Add 比,单击添加 单击“添加”

Finally, Add this link: http://download.eclipse.org/releases/indigo for all the list of Add-Ons 最后,添加此链接: http//download.eclipse.org/releases/indigo以获取所有Add-Ons列表 加

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. 重新启动你eclipse + thumbs-up到我的Ans。 and Start Coding ;) 并开始编码;)

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). 我在我的Windows PC上设置了apache / php / MySQL,因此测试环境与我的服务器完全不同(除了操作系统,但90%的时间都可以)。 I create alias's in the Apache configuration to the Eclipse workspace, and just hop between the browser and eclipse. 我在Apache配置中创建别名到Eclipse工作区,并在浏览器和eclipse之间跳转。 The URL for testing is something like: 测试的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. 虽然这不是理想的,但它是一个相当一致/平滑的过程,不需要在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. 一旦完成设置,我之后就不会花费更多的时间,并且我可以控制我在我的系统上运行的PHP版本。

I don't tend to like integrated browsers for testing of web applications anyway. 无论如何,我不喜欢集成的浏览器来测试Web应用程序。 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. 至少这样,当我通过逻辑的第一次传递时,我完成了Firefox测试。

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:用于PHP,Python,Perl和Ruby开发,具有Web服务器和数据库”

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. 我还建议下载和安装WAMP服务器,这是一个非常容易的Windows等效(Windows,Apache,MySQL,PHP),你可能有一个商业网络主机。 See http://www.wampserver.com for details and download. 有关详细信息和下载,请访问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。

Visit this website https://eclipse.org/pdt/ . 访问该网站https://eclipse.org/pdt/ Go to where it says 'Update existing Eclipse'. 转到“更新现有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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM