×
☰ See All Chapters

PHP Example with Eclipse

In this tutorial you will learn to create PHP example with eclipse IDE.  We use XAMPP package installed on windows operating system to run PHP. Refer the previous tutorial How to Install PHP on Windows to prepare environment to run PHP.

Step 1: Install PHP Development Tools plugin

Install PHP Development Tools Plugin form eclipse marketplace. From eclipse navigate to Help then click on Eclipse Market Place. Now search for PHP. You will get the PHP Development Tools Plugin in search results. Click on Install button to install the plugin.

php-example-with-eclipse-0
 

Step 2: Configure PHP executable

Select Windows>Preferences>PHP>Installed PHPs, then click on Add Button.

php-example-with-eclipse-1
 

Click on Browse button and select the PHP executable php.exe from XAMPP installation. Click on Finish button and then on Apply And Close Button.

php-example-with-eclipse-2
 

Step 3: Create PHP project

Select New>Other

php-example-with-eclipse-3

Select PHP Project and Click Next

php-example-with-eclipse-4

Enter the project name and click Finish

php-example-with-eclipse-5
 

Step 4: Create PHP File

Right click on project and select New>PHP File.

php-example-with-eclipse-6

Enter the name and click Finish

php-example-with-eclipse-7

Enter the below code to the php file

<!DOCTYPE HTML>

<html>

<head>

<title>PHP Example</title>

</head>

<body>

<?php

echo 'Hello World!';

?>

</body>

</html>

php-example-with-eclipse-8

Step 5: Check the output

Right click on index.php, select Run As>Run on Server.

php-example-with-eclipse-9

Select PHP Built-in Server and click Finish

php-example-with-eclipse-10

You should see the output now as below:

php-example-with-eclipse-11

 


All Chapters
Author