Run your first PHP program in XAMPP Server

Starting with PHP is quite easy. If you’re a beginner in PHP, then this post is for you, and will make you feel comfortable in running 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 running first PHP program using XAMPP Server on localhost.

Step 1: Go to the following website and download XAMPP Server,

Figure 1- Download XAMPP ServerFigure 1: Download XAMPP Server

Step 2: After downloading, install it. You can install it at any location, but we installed it at,
C:\XAMPP\

figure-2-xampp-server-installation-locationFigure 2: Xampp Server Installation location

Step 3: Now, go to “htdocs” folder in “Xampp” folder and create your project folder. Here in the screenshot, you can see, a folder “AmitProject” has been created,

Xampp Server-Create project folderFigure 3: Create project folder

Step 4: Now, create a file with php extension. We have created a file with name, FirstProgram.php. Add the following code in it,

Xampp Server - Add a simple PHP programFigure 4: Create a simple PHP program and add the code.

Step 5: Go to start button, and type “Xampp Server” to open it. This will open “Xampp Server- Control Panel”. After opening it, just click “Start” on “Apache”. This will start the server,

figure-5-open-xampp-server-control-panel-and-start-apache-serverFigure 5: Open XAMPP Server Control Panel and start “Apache”

Step 6: Now, go to browser and type, “localhost/AmitProject” and press enter.

On pressing enter, you can see the following, locate your PHP file,

Xampp Server - figure-6-open-ypur-project-in-browserFigure 6: Open your project (localhost/AmitProject) in browser on localhost

Step 7: Just press, “FirstProgram.php” and you can see the output of your first PHP program,

Xampp Server - Check the output of your PHP program

Figure 7: Open FirstProgram.php and see the output

We saw how to run a PHP program using XAMPP Server on localhost. A step 7 process and you can enter the PHP world, on localhost.

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 query, then please mention in the comments section below.

Comments

comments

thegenericwhiz@gmail.com'

GW Editorial Staff

Editorial Staff at Generic Whiz.

Leave a Reply

Your email address will not be published. Required fields are marked *