How To Install Eclipse For PHP On Ubuntu Using PDT

PHP
By bhagwatchouhan
How To Install Eclipse For PHP On Ubuntu Using PDT

In the previous tutorial, we have discussed installing the Eclipse for PHP on Ubuntu. In this tutorial, we will discuss adding PHP development support using PDT plugin to the other Eclipse (Eclipse 2019) packages provided by the Eclipse Foundation.

Notes: You may follow How To Install Java 10 On Ubuntu, How To Install Java 11 On Ubuntu, and How To Install OpenJDK 12 On Ubuntu to install Java on Ubuntu 18.04 LTS. I have installed OpenJDK 12 for this tutorial. You can also follow How To Install PHP 7 On Ubuntu 18.04 LTS to install PHP 7 on Ubuntu 18.04 LTS.

 

Download Eclipse for Web

We will download the Eclipse package for Web and JavaScript developers and install the PDT plugin to add support for PHP development within the same IDE. The steps to install PDT plugin for other Eclipse packages including Eclipse IDE for Enterprise Java Developers remains same.

Open the Eclipse Packages page. It will show the options to download Eclipse IDE for Web and JavaScript Developers as shown in Fig 1. The Eclipse IDE for Web and JavaScript Developers is pre-configured for web and JavaScript development. It also comes with the web development tools and plugins required for Angular and React frameworks.

Download Eclipse for Web

Fig 1

Now click Linux 64 Bit link as highlighted in Fig 1. It will show the download options from mirror sites as shown in Fig 2.

Eclipse For Web Mirror Sites

Fig 2

Click on the Download Button to start the download.

 

Confirm PHP and Java

In this step, we will confirm whether PHP and Java are already installed on the system. You can also follow the links mentioned at the start of this tutorial to install missing PHP and Java on Ubuntu.

# Test PHP version
php --version
# It will show the PHP installed on the system PHP 7.2.19-0ubuntu0.18.04.1 (cli) (built: Jun 4 2019 14:48:12) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.2.19-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies
# Test Java version java --version
# It will show the Java installed on the system openjdk 12.0.1 2019-04-16 OpenJDK Runtime Environment (build 12.0.1+12) OpenJDK 64-Bit Server VM (build 12.0.1+12, mixed mode, sharing

I have installed the most recent version of PHP 7.2 and OpenJDK as shown above.

 

Install Eclipse for Web and JavaScript

In this step, we will install Eclipse for Web and JavaScript as downloaded by us in the previous step.

Extract the Eclipse file downloaded by us. It should be similar to the one as shown in Fig 3.

Eclipse for Web Installation

Fig 3

We can either directly execute the executable file as highlighted in Fig 3 or create a desktop icon by following the next step.

 

Create Desktop Shortcut

In this step, we will install the GNOME panel and use the same to create a desktop shortcut to execute the Eclipse installed by us in previous steps.

# Install GNOME Panel
sudo apt-get install --no-install-recommends gnome-panel
# Create Desktop icon gnome-desktop-item-edit ~/Desktop/ --create-new

Now configure the Eclipse installation as shown in Fig 4. We will use the Eclipse icon available in the root of the installation directory.

Destop Shortcut

Fig 4

Provide name and description of the shortcut as shown in Fig 4. Now click on the Browse Button and navigate to the installation directory of the Eclipse. Choose the executable file as the command option as shown in Fig 4.

Press the OK Button to create the shortcut. The above-mentioned commands will create a desktop shortcut icon so that we can execute Eclipse without navigating to the installation directory. It might ask for security permission for the first time when you will execute Eclipse using the desktop launcher icon.

 

Execute Eclipse and Configure Workspace

In this step, we will execute the Eclipse and configure the workspace. A workspace is a collection of projects and arrangement of the development IDE.

Start Eclipse by either clicking the executable file from installation path or the desktop shortcut icon created by us. It will show the splash screen and show the dialog to choose workspace as shown in Fig 5.

Choose Workspace

Fig 5

Make sure that you have kept the checkbox to choose workspace at start of Eclipse as unchecked so that we can select a different workspace at the start of Eclipse.

Now click on the Launch Button to launch the Eclipse IDE with the selected workspace. It should look similar to the one as shown in Fig 6.

Eclipse Welcome Screen

Fig 6

We can also uncheck the checkbox (Always show Welcome at start up) to hide the welcome screen at the start of Eclipse. It will show the default workspace for Web and JavaScript development as shown in Fig 7 on hiding the welcome screen.

Eclipse Web Workspace

Fig 7

 

Install PDT Plugin

Click on Help -> Eclipse Marketplace to open the marketplace panel. Now search for PDT. It will show the PDT plugin as shown in Fig 8.

Eclipse Marketplace

Fig 8

Click on the Install Button to start the installation of the PDT plugin. The next dialog will show the features (optional and mandatory) to be installed as part of the PDT plugin installation step as shown in Fig 9.

PDT Features

Fig 9

Click on the Confirm Button to start the plugin installation. It will also ask to accept the PDT license agreement as shown in Fig 10.

PDT License Agreement

Fig 10

Click on the Finish Button to continue the installation. This is how we can add PHP development features to the Eclipse IDEs apart from Eclipse for PHP Developers.

After successfull installtion of the PDT plugin, the IDE will ask for restart. Restart Eclipse to make the changes. Click on the Switch Perspective icon to continue with the PHP development similar to how we can develop PHP applications using Eclipse for PHP. The Switch Perspective Dialog is shown in Fig 11.

Switch PHP Perspective

Fig 11

 

Hello PHP

You can refer the tutorial How To Install Eclipse for PHP on Ubuntu to create the first PHP project using Eclipse.

Share this blog:

Profile picture for user bhagwatchouhan
bhagwatchouhan