This article will show you how to enter scripts into the computer, execute them, see how they perform, and see how they display the results.

The first thing you must do is create a new PHP project. The NetBeans IDE provides a wizard to help you do that. Start the NetBeans IDE, and from its main menu select “File New Project…” as shown in Figure 1.

1

Figure 1 Starting a new PHP project from NetBeans IDE

Notice: A PHP project can contain many PHP scripts.

The “New Project” wizard will appear, and it will guide you through the steps that follow.

On the “New Project” screen of the wizard, under “Choose Project,” select “PHP Application” as shown in Figure 2. Then, click on the “Next” button.

2

Figure 2 Selecting the PHP Application under Projects

You will see the “New PHP Project” screen of the wizard. Under “Name and Location” , in the “Project Name” field, type “testingProject” as shown in Figure 3. Leave all other fields unchanged. Then, click on the “Next” button.

3

Figure 3 Selecting the name and location of a new PHP project

Under “Run Configuration”, from the “Run As” dropdown list, select “Script (run in command line)” as shown in Figure 4.

4

Figure 4 Selecting the configuration settings for a new PHP project

Click on the “Finish” button. The project is created and opened in your NetBeans IDE. You should see the following components (see Figure 5):

  • the Projects window, which contains a tree view of the components of the projects, including source files, libraries that your code may depend on, and so on
  • the Source Editor window with a file called “index.php” open. In this file you can write your PHP code. Of course, one single project can contain many such files.

5

Figure 5 Viewing the “Projects” and “Source Editor” windows in NetBeans IDE

Leave a Reply

Your email address will not be published. Required fields are marked *