NetBeans IDE PHP Quick Start tutorial (Web grooming)
- Component Installation
- Set up PHP projects in the NetBeans IDE for PHP
- Run the first PHP project
- Using the database server in the NetBeans IDE for PHP
- Next steps
to learn this tutorial, you need the following software and resources.
| software or resources
|| required version
| NetBeans IDE
||php download package
|| version 5
|web server The
|| recommends using Apache HTTP Server 2.2.
|| XDebug 2 .0 or later
You can install either the PHP engine, the WEB server, and the database separately, or you can use the AMP (Apache, Mysql, PHP) package.
Installation and Configuration
The following document contains a description of one or both methods of setting up the PHP Web stack on the operating system. These instructions are not authoritative. The Web stack is made up of third-party software, and because your environment may be different, you may want to set up PHP with other AMP packages or other methods. You may need to supplement our instructions with your own research.
- Configuring the PHP development environment in Windows
- Configuring the PHP development environment in the Ubuntu Linux distribution
- Configuring the PHP development environment in Mac operating system (Mac OS X)
Set up PHP projects in the NetBeans IDE for PHP
For help with installing and starting NetBeans IDE, see the installation documentation.
To start developing a PHP application in the NetBeans IDE for PHP, you first need to create a project. This project contains information about the location of the project file and how the application is run and debugged (run configuration).
- Start the IDE, switch to the Projects window, and then choose File > New Project (newly created). The Choose project (select project) panel opens.
- In the Categories (category) list, select PHP.
- In the Projects (project) area, select PHP Application (PHP application) and click Next. The "Name and location" Panel of "New PHP Project" is opened.
- In the Project Name text field, enter newphpproject.
- In the Sources folder field, browse to your PHP document root directory and create a subdirectory named Newphpproject here. The WEB server looks for files to open in the browser from the document root folder. The document root directory is specified in the WEB server configuration file. For example, for Xampp, the document root directory is xampp_home/htdocs.
- Leave all other fields at their default values. Click Next. The Run Configuration window opens.
- In the "Run as" drop-down list, select Local Web site. The project will run on the local Apache server. Other options will run the project remotely via FTP and run on the command line.
- Leave the project URL (item URL) as the default value.
- Click Finish. The IDE will create the project.
Learn more aboutSet up PHP projects in NetBeans for more information.
Run the first PHP project
- Launch the IDE and select File > Open Project. ". The Open Project dialog box opens.
- Select newphpproject, and then click Open Project. Displays the Newphpproject tree in the Projects window and opens the index.php file for the project in the editor and Navigator Navigator window.
- Enter The following code inside the BLOCK:
echo "Hello, world! This is my first PHP project! ";
- To run the project, place your cursor over the "Newphpproject" node and select "Run" from the context menu. Shows what you should see in the browser window:
Congratulations! Your program can run properly!
Using the database server in the NetBeans IDE for PHP
You can use a variety of database servers in the NetBeans IDE for PHP, but the most common are MySQL servers. can be fromHere to download.
Note: The recommended version for this product is MySQL Server 5.0.
- Setting up a MySQL database server in the Windows operating system
- Creating a sample database with test data
- MySQL and NetBeans IDE
- Connect to MySQL Database