How to Run a PHP Application on Windows 10 using XAMPP

PHP, one of the popular server-side scripting language widely used for developing web backends is losing its magic. We know that Python and JavaScript are taking the positions of PHP nowadays because of Django, Flask, Nodejs etc. are easy to learn and trending. So the communities are also concentrating on these trending technologies. But we have to accept the reality that more than 60% of the web is powered by PHP. Here I am going to explain the steps in running a PHP application on the Windows 10 operating system.

STEPS

1. INSTALL XAMPP

XAMPP is the most popular PHP development environment.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.

XAMPP can be easily installed using the below URL.

https://www.apachefriends.org/download.html

Just install the latest version (7.2.9) from the list. It is to be noted that only 32-bit version is available for Windows platform, but it works fine in 64 bit Windows.

Image is loading...

Now you will get a XAMPP exe file on Downloads directory. Install this application by double-clicking it (Neglect the warnings by Windows). I have shown the screenshots of the installation steps below.

Image is loading...

2. Clone/Paste PHP our application inside C:\xampp\htdocs

Now we need to clone or paste our PHP application inside C:\xampp\htdocs directory.

If your project is in Git, cone it with the below command.

git clone [git_repository_url]

Or, if your project is in another directory, copy and paste it to C:\xampp\htdocs.

3. Install packages/dependencies (optional)

If our PHP application using any packages/dependencies, we have to install it. The Composer is the most popular package manager for PHP. Running the below command from the root directory of our project install the packages in the package.json file.

composer install

4. Running our project

After everything is set, we can access our project from our browser window. I am assuming that my_php_app is the project directory we pasted/cloned in the previous step. Now we can start our PHP app using the URL.

http://localhost/my_php_app

This will open our PHP app on our browser.

Note that, it only works if our project’s root directory contains index.php or index.html. If not, use the below URL.

http://localhost/my_php_app/file_name.php

You May Also Like

About the Author: Syamlal CM

Hi, I'm Syamlal, the co-founder of Redmonark. I'm a developer, writer and also have a little bit of experience in graphic designing.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.