How to Install PHP with XAMPP on Windows 10

In this guide, I’ll explain how to install PHP with XAMPP on Window. If you like to install PHP with Composer and Apache you can refer to this blog post.

PHP is probably the most used server-side programming language in the world and WordPress which powers over 26% of the web is built with PHP.  It is easier to build a website with PHP than any other server side language out there.

In order to run and build PHP applications, you need to install Apache or Nginx, MySQL on your machine. XAMPP comes prebuilt with all those packages. So you don’t need to install them separately.

Prerequisite

Installing XAMPP

XAMPP Control Panel

Building PHP Projects

Conclusion

Prerequisite

A laptop that runs on window 7, 8, 8.1, or 10.

Let’s get started.

Installing XAMPP

Here you’ll be installing XAMPP.

  1. Goto www.apachefriends.org to download XAMPP
  2. Choose XAMPP for Windows
  3. Wait for your download to start and finish
  4. Double click on the file you just download to begin installation immediately
  5. Follow the setup instruction to complete the installation. Installation typically takes 2-15 minutes depending on your machine memory.

Tips: Keep clicking NEXT throughout the installation.

Below are screenshots showing the installation process to completion. You can skip to Step 2.

XAMPP-Installation-with-php-install
XAMPP Installation with PHP components
XAMPP Installation
XAMPP Installation
XAMPP Installation
XAMPP Installation
XAMPP Installation
XAMPP Installation with PHP
XAMPP Language setup
XAMPP default language: USA English.

After a successful installation, by default, it will start the XAMPP control panel.

XAMPP Control Panel with PHP

Your browser might also open up a web page during installation process. DO NOT bother.

XAMPP Control Panel

By default, to run PHP application, you need to be running Apache on your machine. And since you’ll mostly need a database for your  website, you also need to run MySQL.

XAMPP provide a simple Control Panel to do this. And all you need is to START Apache and MySQL when you need them.

And to start Apache and MySQL:

Click on the XAMPP Icon on your system to open up XAMPP control panel. You can search by CTRL F then type XAMPP.

XAMPP Control Panel with PHP and apache
XAMPP Control Panel v3.2.3

Click on the START BUTTONS beside Apache and MySQL.

XAMPP Apache and MySQL
XAMPP Apache and MySQL

You’ll be doing this whenever you need to run PHP application. You should always check to make sure your Apache and MySQL is running.

XAMPP Apache and MySQL running
XAMPP Apache and MySQL running

Now visit http://localhost on your browser to open XAMPP dashboard.

XAMPP dashboard with PHP, pearl, and MariaDB

On the TOP RIGHT NAVIGATION links click on PHPInfo to see your PHP installation details.

Building PHP Projects

Finally lets create simple hello world app and run.

Now, to do this, go to your XAMPP installation folder. This is normally located in C:\XAMPP.

Inside the XAMPP folder, you’ll see a folder name htdocs.

XAMPP folder with php and htdocs

The htdocs folder  is where you’ll be creating all your PHP website projects.

Create project

In the htdocs folder, create a folder and name it helloworld.

Open a text editor on your system (e.g Notepad) and type the following code:

<?php
    echo "Hello, World!";
?>

Save it as index.php inside the helloworld folder you just created.

Now on your browser type localhost/helloworld  or 127.0.0.1/helloworld and enter to see the result.

Result

Make sure Apache and MySQL are running.

Conclusion

If you follow the instruction correctly, you can now run PHP projects on your Window machine. Feel free to ask me any question on the comment box.



Leave a Comment

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