Skip to main content
install-php-on-windows

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.
    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
  • Click “Next”.
    install-php-on-windows-4
  • Click “Next”.
    install-php-on-windows-5
  • Click “Next”.
    install-php-on-windows-6
  • Click “Next”.
    install-php-on-windows-7
  • Click “Finish”.
    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.
    install-php-on-windows-10
  • Open your browser and type “Localhost”. You will find out screen like below image. Choose your language.
    install-php-on-windows-11
  • 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.
    install-php-on-windows-12

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!!

admin

HI, i am software developer having knowledge of PHP, C, C++ programming languages. I am very passionate about programming and ability to solve the programming problems. CodeandTuts is my blog where i like to put new tutorial and help new developer.