Php – Create Hello World Project with Eclipse – POFTUT

Php – Create Hello World Project with Eclipse


[rps-include post=6522]

While developing Php applications using IDE will provide a lot of useful feature.

Create Hello World Project

We have installed required software properly in previous steps. As a first step we will run Eclipse . We can start eclipse in different ways. In this situation we prefer starting it from Program menu like below.

Another ways to start eclipse is running eclipse command in the terminal like below.

$ eclipse

We will see Eclipse Launcher where we will set projects home directory.

We click OK and resume

Create Php Project

We will create a Php project in eclipse IDE with the following screen. We will click File -> New -> Project

Create Php Project
Create Php Project

Then we will see following screen where we select PHP Project

Then we will set name of the project and click Finish . We can also select Next where we will specify detailed options of the Php project. In this form we can see that project path where it will be stored.

Simply click Yes to setup screen properly for Php project

Add New Php File

We have created our project named Hello World . We need to add some file to the project. We right click on our project on the project pane and select New -> PHP File

Add New Php File
Add New Php File

We will set the file name as index.php which is default most of the Php projects.

Add New Php File
Add New Php File

Configure Php Interpreter and Executable

We need to configure the Php interpreter to run applications in Eclipse. We will click the Eclipse main menu Window -> Preferences and get following screen. From Here we will select Php Executable and click Add

Configure Php Interpreter and Executable
Configure Php Interpreter and Executable

We will set new interpreter’s name as php and path as /bin/php which is default in Linux. Executable path can be found where Php is installed in other operating systems too.

LEARN MORE  How To Download, Install or Uninstall PyCharm On Windows?
Configure Php Interpreter and Executable
Configure Php Interpreter and Executable

Run Php Project

Now everything is ok we can run our Hello World applications after putting following code to the index.php and click Run from menu.

Run Php Project
Run Php Project

This will print Hello World in the console of Eclipse.

Run Php Project
Run Php Project

[rps-include post=6522]

2 thoughts on “Php – Create Hello World Project with Eclipse”

  1. I have tried installing PDT via Marketplace and other ways like Install New Software under the Help menu by specifying latest Eclipse Updates URL.

    I am not seeing File –> New–> PHP File on the File Menu???

    What should I do to get PDT working in Eclipse?

    About Eclipse shows:
    Eclipse IDE for Enterprise Java Developer
    Version: 2018-12 (4.10.0)
    Build id: 20181214-0600

    Reply

Leave a Comment