How to run PHP file on windows using XAMPP

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. 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.
  • click on “Ok” button in below message.
  • You will see window like below. Please click on “Next” button to go next window.
  • Click “Next”.
  • Click “Next”.
  • Click “Next”.
  • Click “Next”.
  • Click “Finish”.
  • Click on XAMPP server icon from the right-bottom side.
  • 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.
  • Open your browser and type “Localhost”. You will find out screen like below image. Choose your language.
  • If you see this screen that 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.

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

  • Open your “C:” drive in windows.
  • Search “XAMPP” folder and click on it.
  • Search “htdocs” folder and click on it.

Put your PHP file in htdocs. Let’s create a simple PHP program and test it.

  • Open “htdocs” folder in xampp as shown above.
  • Create a folder and name it “TEST”.
  • Create a “index.php” file in “TEST” folder. Copy the below code inside it.
  • <?php
    echo "Hii i am PHP programmer and This is my first program";

  • Save the index.php file.
  • Open your browser and navigate your TEST folder 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 article. 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 4+ year of experience of web development. I have worked on codeigniter, symfony, laravel and wordpress.

View all posts by Chintan Panchal →