Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Wiki Markup
Here is a simple sample of using PHP Development Tools (PDT - the PHP programing plugin for Eclipse) on Fedora 7.

(For detail information on how to install PDT for Eclipse in Fedora 7 and CentOS 5, please visit:
[Installing PHP Development Tools on Fedora 7]
[Installing PDT and PHPEclipses on CentOS]) {info:title=Please note that}
In this example, I logged in as "zhaonx" and "\home\zhaonx\" is my home direcotry.{info}

h4. Start Eclipse

Start a terminal window; then go into the directory where Eclipse is installed (unpacked from tar ball); and then start eclipse.
cd \home\zhaonx\eclipse
./eclipse &
{code}{tip:title=Create a menu item for Eclipse}
You can create a menu item for Eclipse, then you do not need to do the above step. {tip}

h4. Create a new PHP project

* When Eclipse is staring, a "workspace launcher" window will appear and ask to select a workspace (Figure 1). You can click "Ok" to create a default workspace in your home directory or you can select a workspace you've created by clicking "Browse...".
<DIV align="center">Figure 1: Select workspce</DIV><BR></BR>{html}

* Click "File->New->Project...", a "New Project" window will appear (see Figure 2). Double click the line "PHP" and select "PHP Project", then click "Next". A "PHP Project" window will appear (see Figure 3). Give a project name, and then click "Finish". Eclipse will ask to open associated perspective, click "Yes".
<DIV align="center">Figure 2: Select New Project window</DIV><BR></BR>{html}

!php_project_small.png|align=center!\\ {html}
<DIV align="center">Figure 3: New PHP Project Window</DIV><BR></BR>{html}

h4. Add PHP File in your PHP project

After you create a PHP project, you need to add PHP file into your project.

!php_project_test_small.png|align=center!\\ {html}
<DIV align="center">Figure 4: PHP project working space window</DIV><BR></BR>{html}
In the above PHP project working space window, right click on "test" in PHP Explorer window, then in the pop-up menu, click "New->PHP File". (Figure 5)
!new_php_file_small.png|align=center!\\ {html}
<DIV align="center">Figure 5: Pop-out menu</DIV><BR></BR>{html}
In the "New PHP File" window, give a name for the new PHP file, and click "Finish". A new PHP file will be created (in my case, index.php) and will be open in PHP Project working space. It should looks link Figure 6. Add code in this opened php file and save the file.
!php_new_file_opened_small.png|align=center!\\ {html}
<DIV align="center">Figure 6: Index.php file is opened</DIV><BR></BR>{html}

h4. Debug PHP file

Set a break point in your simple PHP file. There are several ways to do so. One way is double click the space before the line number of the line you want to set breakpoint. Another way is to click the line you want to set breakpoint, and then click menu "Run" and select "Toggle Breakpoint" to set or unset breakpoint.
!set_breakpoint_comment_small.png|align=center!\\ {html}
<DIV align="center">Figure 7: Set breakpoint</DIV><BR></BR>{html}
There are two types of debugging. One is debugging as "PHP Script" and another is debugging as "PHP Web Page". To debug as "PHP Script", click "Run->Debug as->PHP Script", Eclips system will ask to open PHP debug perspective. Click "yes" to open the proper perspective.
!php_debug_as_script_small.png|align=center!\\ {html}
<DIV align="center">Figure 8: Debug as PHP Script</DIV><BR></BR>{html}
To debug as "PHP Web page", click "Run->Debug as->PHP Web Page". You need to set the URL for your web browser to launch the PHP web page. To ensure the URL is accessible, you need to edit your http configuration file (in \etc\httpd\conf on Fedora 7) to set a alias or directory for the project you've created. For example, in my case, I need to set directory "/home/zhaonx/workspace2/test" accessible to web browser; and I want to use "http://localhost/test/" as the URL to debug my test.php file. I need to add the following code in my \etc\httpd\conf\httpd.conf file.
Alias /test/ "/home/zhaonx/workspace2/test/"
<Directory "/home/zhaonx/workspace2/test">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all