20 Jul Run your first PHP program in XAMPP Server on localhost
Beginning with PHP is quite easy. If you’re a beginner, then this post is for you and will make you feel comfortable running the PHP program on XAMPP Server. Begin developing your website on localhost, and then move forward and upload the website live, with a domain name and hosting account.
Let’s start with installing XAMPP, and running the first PHP program using XAMPP Server on localhost. The following are the steps:
- Download and Install XAMPP
- Create a new project in XAMPP and add your PHP program
- Open XAMPP and run your first PHP program
Download and Install XAMPP
Step 1: Go to the Apache Friends website and download XAMPP Server. Apache Friends is the official website to download XAMPP:
Step 2: After downloading, install it.
You can install it at any location. We installed XAMPP ic C: drive,
Create a new project in XAMPP
Step 3: Now, go to the htdocs folder in the Xampp folder and create your project folder.
Here, a folder AmitProject created, as in the below screenshot:
Step 4: Now, create a file with the .php extension. We have created a file with the name, FirstProgram.php.
Add the following code to it,
Open XAMPP and run your first PHP program
Step 5: Go to the start button, and type Xampp Server to open it.
This will open Xampp Server- Control Panel. After opening it, just click Start on Apache to start the server:
Step 6: Now, go to the Web Browser and type, the following and press enter:
On pressing enter, you can see the following, locate your PHP file FirstProgram.php and click on it:
Step 7: Just press enter in the address bar, and you can see the output of your first PHP program FirstProgram.php:
We saw how to run a PHP program using XAMPP Server on localhost. A step-by-step process to create a new PHP program file and run it to get the output.
Here’s the video, explaining the steps shown above,
Note: You do not have to START Apache Server again and again. But, yes, if you “shut down” and “restart” your system, then there is a need of starting the server again.
Hope you liked the tutorial, kindly share it with others.
If you have any queries, then please mention them in the comments section below.