How To Install NetBeans 12 for PHP on Ubuntu 20.04 LTS
It provides all the steps required to install NetBeans 12 distributed by Apache Software Foundation for PHP development on Ubuntu 20.04 LTS. It also explains the steps required to create a PHP project and write a PHP program.
In this tutorial, we will discuss the steps required to install NetBeans 12 on Ubuntu 20.04 LTS for PHP development. It provides the installation steps required to install it using the binary files distributed by Apache and write our first PHP program i.e. Hello World.
This tutorial assumes that appropriate Java ( 8 or 11) and PHP are already installed on the system. You can follow How To Install PHP On Ubuntu 20.04, How To Install PHP 8 On Ubuntu 20.04 LTS, How To Install Java 11 On Ubuntu, How To Install Java 17 On Ubuntu 20.04 LTS, and How To Install OpenJDK 17 On Ubuntu 20.04 LTS.
You can also follow How To Install NetBeans 12 for PHP on Windows to install NetBeans 12 on Windows.
Download NetBeans 12
Click Here to visit the download page having appropriate download links and instructions to verify the download as shown in Fig 1.
Now click the Download Button as highlighted in Fig 1. It provides the links to download the installer for Ubuntu as highlighted in Fig 2.
Click the Download Link as highlighted in Fig 2. It will show the download mirrors as shown in Fig 3.
Now click the suggested link to start downloading NetBeans 12 for Ubuntu 20.04 LTS.
Launch NetBeans 12 Installer
Navigate to the directory where NetBeans 12 file has been saved and execute the below-mentioned commands to launch the installer. I have downloaded the file Apache-NetBeans-12.5-bin-linux-x64.sh while writing this tutorial.
# Change Permissions
sudo chmod +x Apache-NetBeans-12.5-bin-linux-x64.sh
# Launch Installer
It shows the Welcome Screen as shown in Fig 4.
You may customize the components by clicking the Customize Button. It provides the options to choose the components as shown in Fig 5.
Click the OK Button after selecting the appropriate components. Now click the Next Button to continue the installation. It provides the options to accept the License Agreement as shown in Fig 6.
Accept the License Agreement as shown in Fig 6, and click the Next Button. The next screen provides the options to configure the installation path and choose the JDK as shown in Fig 7.
You may change the installation path of JDK if required. Now click the Next Button to continue the installation. The next screen shows the installation summary as shown in Fig 8.
Click the Install Button to finalize the installation. It shows the installation progress as shown in Fig 9.
The installer shows the success message on completing the installation as shown in Fig 10.
Now click the Finish Button to close the installer. This completes the installation of NetBeans 12 on Ubuntu 20.04 LTS. Click the Settings Icon at the bottom left to confirm whether NetBeans was installed successfully. It should show the Application Icon as shown in Fig 11.
Click the NetBeans Icon to launch the IDE. It shows the default Start Page as shown in Fig 12.
Create PHP Project
In this step, we will create our first PHP project using NetBeans 12.
Click the File Option on Main Menu and then click the option New Project. It will open the New Project Wizard as shown in Fig 13.
Select PHP from the Categories options and also select PHP Application from Projects options as shown in Fig 13. The NetBeans 12 will show a message in the description section to enable appropriate plugins required for PHP development, in case it's the first project. Now click the Next Button. On the next wizard, NetBeans will find the corresponding plugins required for PHP development and shows the options to configure Name and Location as shown in Fig 14.
Provide the Project name and location based on your requirements and also select the PHP version. I have selected PHP 8 installed on my system. You can follow How To Install PHP 8 On Ubuntu 18.04 LTS. Now click on the Next Button. The next wizard provides options to choose the project's runtime configurations. I have selected Script for this tutorial as shown in Fig 15. It also asks for the corresponding PHP Interpreter to execute the program for the Script Option. The configuration in my case should be similar to the one shown in Fig 15.
Apart from the Script Option to run PHP program on the console, there are few more options specific to Runtime including Local Web Site, Remote Web Site, and PHP Built-in Web Server. This tutorial does not discuss the additional Runtime configuration. After selecting the Script as a Runtime option, we can also select the location where PHP is installed.
Click the Next Button. The next wizard will ask to select the PHP Framework as shown in Fig 16. We will simply skip this step since we will be writing a simple HelloPHP program in this tutorial.
Click last time on the Next Button. The next wizard shows options to configure the project for Composer as shown in Fig 17.
We will leave it blank and click the Finish Button. The project with the default index.php file created by NetBeans looks like the one shown in Fig 18.
In this step, we will update the index.php program and execute it on the console. Write Hello PHP as shown below.
echo "Hello PHP !!";
Now, right-click the index.php file in the Projects Window on the left panel. Also, click the Run Option to execute the program. You can also select the File on Projects Window and press Shift + F6 to execute the program. It will show the output as shown in Fig 19.
These are the basic steps required to install NetBeans 12 for PHP development on Ubuntu systems.
This tutorial provided all the steps required to install the most recent version of NetBeans 12 on Ubuntu 20.04 LTS. It also provided the steps required to create the first PHP project and execute the first PHP script.