Last reviewed on 2019-02-02
- Requirements
- Installation and Configuration
- Setting up a PHP Project in the NetBeans IDE for PHP
- Running Your First PHP Project
- Using Database Servers with NetBeans IDE for PHP
This document provides general guidelines for preparing the environment for PHP development, setting up a PHP project, and developing and running your first PHP application in the NetBeans IDE for PHP.
Requirements
To follow this tutorial, you need the following software and resources.
A PHP engine | Version 5 |
A web server | Apache HTTP Server 2.2 is recommended. |
A PHP debugger | XDebug 2.0 or later |
You can install the PHP engine, web server and database separately or use AMP (Apache, MySQL, PHP) packages.
Setting up a PHP Project in the NetBeans IDE for PHP
To start PHP development in the NetBeans IDE for PHP, you first need to create a project. A project contains the information on the location of the project files and the way you want to run and debug your application (run configuration).
Start the IDE, switch to the Projects window, and choose File > New Project. The Choose Project panel opens.
In the Categories list, choose PHP.
In the Projects area, choose PHP Application and click Next. The New PHP Project > Name and Location panel opens.
Figure 1. Name and Location panel of New PHP Project wizard, with Source Folder location as XAmpp document root.
In the Project Name text field, enter NewPHPProject .
In the Sources Folder field, browse for your PHP document root and create a subfolder there called NewPHPProject . The document root is the folder where the web server looks for files to open in the browser. The document root is specified in the web server configuration file. For example, on Xampp, the document root is XAMPP_HOME/htdocs.
Leave all other fields with 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 your local Apache server. Your other options are to run the project remotely via FTP and to run it from the command line.
Leave the Project URL at default.
Click Finish. The IDE creates the project.
Running Your First PHP Project
Start the IDE, choose File > Open Project. The Open Project dialog box opens.
Select NewPHPProject and click Open Project. The NewPHPProject tree appears in the Projects window and the project’s index.php file opens in the editor and in the Navigator window.
Enter the following code inside the <?php ?> block:
echo "Hello, world! This is my first PHP project!";
To run the project, position the cursor on the NewPHPProject node and choose Run from the context menu. The figure below shows what you should see in the browser window:
Congratulations! Your program works!
Using Database Servers with NetBeans IDE for PHP
You can use various database servers with the NetBeans IDE for PHP, although the most popular is the MySQL server. Downloads are available here.
Last updated on Mar 26,2022 206.7K Views
A technophile who likes writing about different technologies and spreading knowledge. A technophile who likes writing about different technologies and spreading knowledge.
How to run a PHP program in Xampp?
PHP is the most popular web backend programming language. A PHP code will run as a web server module or as a command-line interface. To run PHP for the web, you need to install a Web Server like Apache and you also need a database server like MySQL. There are various web servers for running PHP programs like WAMP & XAMPP. WAMP server is supported in windows and XAMP is supported in both Windows and Linux. In this article, you will learn how to run PHP program in Xampp server.
Below topics are covered in this article:
- What is Xampp?
- Install Xampp
- How to run PHP program in Xampp?
Let’s get started.
What is Xampp and why it is used?
Xampp stands for Cross platform(x), Apache(a), Maria db(m), PHP(p), Pearl(p) which is a software distribution server which makes developer’s work eaiser for testing and deploying by creating a local web server.
How to install Xampp?
It is completely free and easy to install Apache distribution containing MySQL, PHP, and Perl. First, download XAMP from //www.apachefriends.org/download.html. In the first page, select the components you want to install.
Select the installation directory so that all the components that you choose will be installed in this directory.
XAMP also allows you to easily install PHP based applications. Bitnami module provides the easiest way to install WordPress, Drupal or Joomla among others on top of your XAMP after the installation you will see the control panel.
Once you are done with Xampp installation, let’s move ahead and see how to run a PHP file in xampp server.
How to run PHP program in Xampp step-by-step?
Write this program in a notepad and save it as file.php or any other name.
After completion of the installation, you can use the XAMPP Control Panel to start/ stop all servers.
Start Mysql and Apache servers.
Copy file.php to htdocs (C:/Program Files/XAMPP/htdocs)
You can also create any folders inside htdocs folder and save our codes over there.
In order to get the dashboard for localhost: search //localhost in any browser.
Now to run your code, open localhost/file.php then it gets executed.
With this we come to an end of this article. I hope you have learned about XAMP, the installation of XAMP and how to run a PHP program in Xampp.
If you found this Tutorial blog relevant, check out the PHP Certification Training by Edureka, a trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe.
Got a question for us? Please mention it in the comments section of ”how to run a php program in xampp” and I will get back to you.
Recommended videos for you
PHP and MySQL : Server Side Scripting For Web Development
Watch Now
Hibernate-the ultimate ORM framework
Watch Now
MS .Net – An IntelliSense Way of Web Development
Watch Now
Microsoft SharePoint-The Ultimate Enterprise Collaboration Platform
Watch Now
Microsoft .NET Framework : An IntelliSense Way of Web Development
Watch Now
Building Application With Ruby On Rails Framework
Watch Now
Create Restful Web Application With Node.js Express
Watch Now
Learn Perl-the Jewel of Scripting Languages
Watch Now
PHP & MySQL : Server-side Scripting Language for Web Development
Watch Now
Service-Oriented Architecture With Java
Watch Now
NodeJS – Communication and Round Robin Way
Watch Now
Effective Persistence Using ORM With Hibernate
Watch Now
Building Web Application Using Spring Framework
Watch Now
A Day In The Life Of A Node.js Developer
Watch Now
Recommended blogs for you
How To Implement Function Overloading And Overriding In C++?
Read Article
Array Length In Java: Everything You Need To Know About Array Length In Java
Read Article
What is a Constant in Java and how to declare it?
Read Article
Comparable in Java: All you need to know about Comparable & Comparator interfaces
Read Article
Node.js NPM Tutorial – How to Get Started with NPM?
Read Article
Java Abstraction- Mastering OOP with Abstraction in Java
Read Article
Array Of Objects In Java: Everything You Need To Know About Array Of Objects
Read Article
Everything You Need To Know About Unserialize In PHP
Read Article
Learn How to Make Node.js Requests – Best 3 Ways to Make HTTP Request
Read Article
How to Find the largest number in an Array in Java?
Read Article