How to run PHP file on windows using XAMPP

In this tutorial, i will show you how to run PHP file on windows using XAMPP server.

PHP is a server side programming language which is mostly useful in dynamic web development. PHP does not come in windows directly. To run PHP file in windows, we need to install PHP in windows with APACHE web server. Individually installing PHP and APACHE in windows are tedious process.

So here we will use most famous PHP development environment XAMPP server. XAMPP is a completely free, easy to install Apache distribution containing MariaDB, PHP, and Perl. The XAMPP open source package has been set up to be incredibly easy to install and to use.

You can install XAMPP in windows and linux operating system. So let’s start it step by step.

First of all we have to install a XAMPP server, XAMPP is very easy to install and very powerful. Follow the below steps to install XAMPP server.

Download XAMPP server from Download XAMPP. Now click on it’s .exe file.

You will see window like this. Click on “Yes” button.

install-php-on-windows-1

Click on Ok button in below message.

install-php-on-windows-2

You will see window like below. Please click on Next button to go next window.

install-php-on-windows-3

You can customize component as per your require. I will not change anything and click Next button.

install-php-on-windows-4

Here you can choose directory where you want to install xampp.

install-php-on-windows-5

Click Next button.

install-php-on-windows-6

Click Next button.

install-php-on-windows-7

Click Finish button

install-php-on-windows-8

Click on XAMPP server icon from the right-bottom side.

install-php-on-windows-1-9

If you do not find out that icon there then click on start button and search xampp control panel. Click on it. You will find out the window like below. Start APACHE and MySQL here.

Related:  30+ core PHP examples and tutorials for beginner

install-php-on-windows-10

Open your browser and type http://localhost. You will find out screen like below image. Choose your language.

install-php-on-windows-11

If you see this screen than your XAMPP server installed successfully for PHP and MySQL. In the left side corner you will find out “PHPMYADMIN”. This is most famous MySQL database software which will help you most in database management.

install-php-on-windows-12

Now it’s time to test my first PHP program. Follow the below steps.

Create index.php file under C:/XAMPP/htdocs/TEST . Make sure if there is no TEST directory in htdocs then make it.

index.php

<?php
echo "Hii i am PHP programmer and This is my first program";
?>

Save the index.php file.

Open your browser and navigate path like this way http://localhost/TEST/index.php

That’s it, you complete your first PHP program. Best of Luck!!

As a developer, I hope that you may like this tutorial on how to run PHP file on windows using XAMPP server. Article is full of information but still if you have any question then let me know in the comment box. I will help you to solve it. Thank you friends!!

About Chintan Panchal

I am web developer having 6+ year of experience of web development. Currently working on laravel and have worked on codeigniter, cakephp, symfony. Thank you :)

View all posts by Chintan Panchal →