Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Help setting up php for Eclipse

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.

like image 524
NotDan Avatar asked Oct 26 '08 18:10

NotDan


People also ask

Can I use PHP in Eclipse?

The PHP IDE project delivers a PHP Integrated Development Environment framework for the Eclipse platform. This project encompasses the development components necessary to develop PHP-based Web Applications and facilitates extensibility.

How do I run a PHP based website?

To run PHP for the web, you need to install a Web Server like Apache and you also need a database server like MySQL. There are various web servers for running PHP programs like WAMP & XAMPP. WAMP server is supported in windows and XAMP is supported in both Windows and Linux.


4 Answers

There is a plugin for Eclipse called PDT which makes PHP development a breeze.

For an overview on how to install it, you can refer to the Eclipse website:

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.

like image 76
Josh Sandlin Avatar answered Oct 20 '22 16:10

Josh Sandlin


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)

(2) One you have eclipse fired-up in you machine Do followings : Help > Install Software

Help > Install Software

Than, Click On Add Click On Add

Finally, Add this link: http://download.eclipse.org/releases/indigo for all the list of Add-Ons Add

and pick PHP under Web Addon (Should be last in the list) and Install it.

Restart you eclipse + thumbs-up to my Ans. and Start Coding ;)

like image 34
DPP Avatar answered Oct 20 '22 18:10

DPP


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:

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.

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.

like image 4
acrosman Avatar answered Oct 20 '22 17:10

acrosman


try easyeclipse, it the easiest Eclipse setup i've found

"EasyEclipse for LAMP: For PHP, Python, Perl, and Ruby development with a web server and a database"

like image 2
Luis Melgratti Avatar answered Oct 20 '22 16:10

Luis Melgratti