In this blog post(PHP Program: Make Your First PHP program), I will let you know, how to make your first PHP program step by step?
Most of you would be very curious about How do I write my first PHP program? Where do I code PHP? Which software is used to run PHP programs? PHP programming examples for beginners, How to run PHP code in HTML file,…
…..and there might be several questions in the programmer’s mind at the beginning. We will solve all your queries related to your first PHP program in this extensive blog.
This will be very beneficial to those aspirants who are very new to a programming language. They will learn here that how to make the first PHP program.
We will teach you this program at the localhost using the Xampp server as PHP requires a server to run.
Xampp server consists of both an Apache server for running our code SQL database for storing our project data.
Netbeans is an IDE(Integrated Development Environment) that was primarily intended for Java but also supports languages like PHP, HTML, CSS, XML, JS, XHTML and etc.
Which software is used to run PHP programs?
For making your very first PHP program you should need the below-given software:
1. Install Net Beans software.
2. Install Xampp Server.
What is the procedure to make my first PHP program? / How do I start a PHP project?
Once you installed both the software given above you can follow the below step by step procedure for making your first PHP program.
Open your NetBeans ID and click on file, and then click on a new project as shown the in the below image.
Here select the PHP option and click on the Next button as shown in the below image.
Give a suitable name to your project and then click on the Finish button as shown in the below image.
Your project has been created and now you can easily write your first PHP program. Here you can write both the code HTML as well as PHP code.
PHP code always is written inside the <?PHP……?>
<?PHP – php opening tag
//Write PHP code
?> – PHP closing tag
Write your first PHP program, here you can also remove the HTML elements if not using any HMTL code. See the code below.
Echo: this keyword is used to print the statement on the screen.
Now, you are ready to run your project, just start your Xampp server and start your Apache server as shown in the below image. In this project, we are not using a database so there is no need to start MySQL Server. See the below image for the same.
How do I run a PHP program?
Now, you can run your program: you just do the right click on the mouse and then click the Run file as shown in the below image. You can also run the project by typing:
HTTP://localhost/projectname/index.php on the browser.
This is the output of your program as shown in the below image.
So in this blog post, we have several tricky things about making of first PHP program like How do I write my first PHP program? How do I start a PHP project? How do I get PHP to work in HTML? Where do I code PHP? How do I run a PHP program?
After going through this blog you will be capable to write a simple PHP program and run them with the help of NetBeans IDE and XAMPP server. We will update this blog soon and also will let you know some other way to write the PHP program and run them without the help of any software or IDE like Netbeans.
In case of any queries, you can write to us at @[email protected] we will get back to you ASAP.
Hope! you would have enjoyed this post to make your first PHP program.
Please feel free to give your important feedbacks in the comment section below.
Have a great time! Sayonara!