Php – Create Hello World Project with Eclipse
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.
We will see
Eclipse Launcher where we will set projects home directory.
OK and resume
Create Php Project
We will create a Php project in eclipse IDE with the following screen. We will click
Then we will see following screen where we select
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.
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
We will set the file name as
index.php which is default most of the Php projects.
Configure Php Interpreter and Executable
We need to configure the Php interpreter to run applications in Eclipse. We will click the Eclipse main menu
Preferences and get following screen. From Here we will select
Php Executable and click
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.
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.
This will print
Hello World in the console of Eclipse.