Develop and Deploy a PHP Application with Eclipse

 

Follow these instructions to use Eclipse to develop and deploy your PHP application to the OEF Hosted Environment.

Before you begin:

  • Obtain your OEF Hosted Environment URL, username, and password from your coach.
  • Make sure you have unrestricted Internet access and that proxy servers or firewalls are not blocking access to the below-noted resources.

Install the Software

Download and install the following software. Accept the default components for each install.

Configure Eclipse

Start the packages:

  • Start Eclipse.
  • In the main window go to Help > Install new Software.

    Eclipse - Install New Software

In the "Available Software" window:

  • In the "Work with" field, enter "Indigo - http://download.eclipse.org/releases/indigo".
  • A list of available updates/modules will display.
  • Expand "Programming Languages" and choose "PHP Development Tools (PDT) SDK Feature".
  • Click "Next".

    Programming language choice

The "Install Details" window appears.

  • Click "Next".

    Eclipse - Install details

Read and accept the license agreement.

  • Click "Finish".

    Eclipse - Accept License

Eclipse will start fetching the packages. You will be to prompted restart Eclipse after this process.

Configure BitKinex WebDAV Client

Create new WebDAV connection to the OEF Hosted Environment:

  • Open BitKinex. The first time you open BitKinex you will need to answer network setup questions based on your internet connection.
  • In the main window, go to Data Source > New > Http/WebDAV.
  • Enter the name for this connection. In this example, we name the connection "ThinkQuest".

    BitKinex - New Connection

In the "Server" window, enter your OEF Hosted Environment URL, username and password:

  • In the "Server address" field, enter the OEF Hosted Environment URL. In this example, we use "xxddtjwifeogcqgavnwa.thinkquest.org".
  • From the "Security" dropdown list, select the "SSL".
  • In the "Authorization" section, enter the OEF Hosted Environment username and password.

    BitKinex - Server Settings

Enter the OEF Hosted Environment folder for deployed PHP files:

  • Go to Server > Site Map from the options on the left.
  • In the "Path" column of the table, click the slash (/).
  • Enter "/upload/php/" in the text box below the table.
  • Click "Update". The default path will be changed to "/upload/php/".
  • Click "OK". The WebDAV connection to the OEF Hosted Environment is now configured.

    BitKinex - Webdav Connection

Test the WebDAV connection to the OEF Hosted Environment:

  • In the main BitKinex window (see the image at the start of this section), double-click the "Http/WebDAV" connection you created previously. In this example, the connection is "ThinkQuest".
  • BitKinex will connect to the OEF Hosted Environment. You will see the server folders on the left (ThinkQuest) and your local folders on the right (My Computer).

    BitKinex - Connect

Create your Application

Create a new project for your PHP application using Eclipse:

  • Open Eclipse.
  • Open the PHP Perspective.
  • Go to Window > Open Perspective > Other.
  • Choose "PHP" from the list.
  • Click "OK".

    Eclipse - New PHP Project

Create a new project:

  • Go to File > New > New PHP Project.

Name your project:

  • In the "Project Name" field, enter a name for your project. In this example, we name the project "HelloWorld".
  • In the "Directory" field, enter the project path. In this example, the project path is "C:\ThinkQuest\HelloWorld".
  • Click "Finish".

    Eclipse - Project Settings

Create an index.php file:

  • Go to New > PHP File.
  • The "Source File" field will pre-populate.
  • In the "File Name" field, enter "index.php".
  • Click "Next".

    Eclipse - PHP File
  • From the Templates section, Select "New simple PHP file".
  • Click "Finish".

    Eclipse - PHP Template

Edit the index.php file:

  • The index.php file contents will be displayed in the main Eclipse window.
  • Enter (or copy/paste) the following example code in the index.php content window:
    <!DOCTYPE html>
    <html">
    <head>
    <title>HelloWorld</title>
    </head>
    <body>
    <?php
    Print "Hello World!";
    ?>
    </body>
    </html>

Deploy your Application

Locate the source files of your PHP application on your local computer:

  • In the main BitKinex window (see the image at the start of the "Configure BitKinex WebDAV Client" section), double-click the "Http/WebDAV" connection you created previously. In this example, the connection is "ThinkQuest".
  • BitKinex will connect to the OEF Hosted Environment. You will see the server folders on the left (ThinkQuest) and your local folders on the right (My Computer).
  • In the "My Computer" window, open the "Sources Folder" where you stored your PHP project files. In this example, the folder is "C:\ThinkQuest".

    BitKinex - Local Drive

Deploy the source files to the OEF Hosted Environment:

  • In the "My Computer" window, select the files and folders you want to deploy.
  • In the "ThinkQuest" window, confirm that "upload/php/" folder is selected.
  • Move the selected files and folders from the "My Computer" window to the "ThinkQuest" window using the left arrow button. In this example, we moved the file "index.php".

    BitKinex - Remote Server

Your application is deployed and can be run in a browser. In this example, the URL is:

  • https://xxddtjwifeogcqgavnwa.thinkquest.org/php/display/