In this blog post, I will let you know, how to make your first PHP program step by step?
This will be very beneficial to those aspirants who are very new to a programming language. They will learn here that how to make first php program.
We will teach you this program at localhost using Xampp server as PHP requires a server to run.
Xampp server consists both an Apache server for running our code SQL database for storing our project data.
Netbeans is an IDE(Integrated Development Environment) which was primarily intended for Java but also supports languages like PHP, HTML, CSS, XML, JS, XHTML and etc..
What software is needed to make this first PHP program?
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?
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 next button as shown in the below image.
Give a suitable name to your project and then click on 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 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.
Now, you can run your program: you just do the right click on the mouse and then click 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.
In a case of any queries, you can write us at @firstname.lastname@example.org 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!