Eclipse-------Develop PHP projects with Eclipse ____php

Source: Internet
Author: User
Tags php development environment

First, installation
The first time to use Eclipse to develop PHP projects, installation or will take a certain period, a careful look at this article, you can save a lot of time. First of all. The Eclipse project is developed in Java, so it needs to run on a Java virtual machine, and Eclipse defaults to no virtual machines, so if you don't have a Java virtual machine installed on your machine (not installed on a typical Windows machine), you'll have to install one, By the way, installing a Java Virtual machine has J2SDK and j2re to choose from, J2sdk contains j2re, additional source programs, documents for Java developers to use, and more than J2re, Eclipse's operation as long as j2re support on it, Therefore, it is recommended to install a j2re version, according to the description of Eclipse, j2re1.3.1 above can be, generally downloaded from the Internet is j2re1.4.x.
Eclipse is a very good development environment, Java support is the most powerful, but he designed a plug-in-oriented structure, to install a plug-in, he can well develop C + + programs or PHP programs, or even UML. Here, we are going to use Eclipse's plugin, named PHPEclipse. This plugin provides the creation of PHP Engineering, PHP syntax highlights, PHP code automatic completion, as well as from the help to exhale PHP documents and other very useful functions, there is also worth mentioning is that the development of PHP is generally a Web page, this plug-in with a phpbrowser, when you save the PHP program , the Web page automatically refreshes, which saves you every time you modify the program code to see the results of the operation to switch to another window to refresh a trouble. Of course, I thought it would be nice to run the PHP program with the Eclipse Console window, to have the feeling at the WIN2000 command prompt, unlike other software such as Zend Studio or edit Plus, until all the programs were running, to show the results. It was really cool. Of course want to run the web-based PHP program, apache,iis you have to install yourself, PHP you have to install and configure, PHPEclipse will not be arranged for you, not to expect eclipse, perhaps it does not know what is called PHP. However, there is a wampp software package, download it down a decompression of everything is done, phpeclipse it is compatible with.
Said so much, may have already said you impatient, it is not so troublesome. Don't worry, as long as you've tasted the benefits of using eclipse to develop PHP, you may soon be in love with him. And, all of this is free, do not need to play patches, do not download the registration code-).
Now let's install it step-by-step.

The first step, download installation j2re or J2SDK.
J2re 1.4.2
J2SDK 1.4.2

Step two, download eclipse
and extract to d:/disk, automatically generate Eclipse directory

Step three, download PHPEclipse
and copy to the D:/eclipse directory, right-click, extract to the current directory, will be extracted from the plugins and features directory of all content, respectively, in the Eclipse directory in the Plugins and features directory (since the supplement).

Step fourth, start Eclipse
Double-click Eclipse or enter eclipse at a command prompt to start Eclipse

The following steps are optional, and it is recommended that you do not do the following at the first installation. After some familiarity with eclipse, and then do the following operation, the purpose of the WAMPP is to install the apache,mysql,php, the installation of DBG Plug-ins are designed to debug the PHP program, these plug-ins in the future when it is necessary to install.
Step Fifth, install WAMPP
Extract to d:/wampp2 directory, install details of d:/wampp2/wamp-2.2.txt file
to modify the Apache configuration file as follows: d:/wampp2/ Apache/conf/httpd.conf
Alias/eclipse "/wampp2/eclipse/workspace/"

<directory "/wampp2/eclipse/workspace/"
Options Indexes multiviews
allowoverride None
Order Allow,deny
Allow to all
Move the D:/eclipse directory to the D:/wampp2/eclipse directory, create a batch file under D:/wampp2, and enter the following command:
Eclipse/eclipse.exe- Clean
starting eclipse in this manner automatically remount the plug-in. At this point, the installation can be completed.

Two, develop a PHP project
When you start Eclipse, use the menu "new"-> "PHP Project" to successfully create a PHP project.
Again "new"-> "file", you can create a PHP source program file, you can enter the following code
:   class Foo { var $name = "";  function Bar () {   echo "foo::bar ()";  }}   Foo::bar ();?>

PHP classes such as Foo and function bar () can be identified and displayed in a tree shape in the Outline window, which is useful when developing large projects.
If you install WAMPP, you can click the "Start Apache" menu or the shortcut icon to start Apache, you can show the results of the run.
If you have installed PHP manually, you can configure PHP.exe in Run/external tools to run the program and display the results in the console window.

Third, PHPUnit
PHPEclipse contains a phpunit window, but I looked at a lot of phpeclipse documents, did not find the use of the PHPUnit window, I hope to have the knowledge to write the article to tell you or send me a copy, thank you.
People who are often developed with PHP may know that there is a PHPUnit2 project in pear, and I have a quote from PHPUnit2 's author Sebastian on December 16, 2004:
> I am the author of PHPUnit2 [1] and recently started using PHPEclipse.
> What would is needed in order to get PHPUnit2 support in PHPEclipse?
> Afaics currently only the outdated PHPUnit this is hosted at SourceForge
> is supported.
A.c.kramer's reply is:
Sorry for answering so late.
Don "T know exactly why, but your mail slipped through my filters.

Ali Echihabi [1] has started a-PHPUnit plugin in the CVS module:
Net.sourceforge.phpeclipse.phpunit [2]

I Don "t know exactly the current development status,
But I didn "t hear from Ali, the last 2 months.
If you are are interested in improving the module, I can give you developer
Please let us know if you need further the existing CVS module.
Only for interested readers, I will not translate here.

Iv. Summary

PHPEclipse uses the Eclipse tool to provide a convenient PHP development environment, not only for a master like Sebastian, but also for large projects that can be almost as supportive as Java development tools.
In addition, I also hope that the PHP refactor browser,php unit and other excellent tools can be combined under the phpeclipse better, for PHP developers to provide a near-perfect solution.

Original address:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.