How to Run a PHP Application on Windows 10 Using XAMPP

php-windows10
PHP WindowsLeave a Comment on How to Run a PHP Application on Windows 10 Using XAMPP

How to Run a PHP Application on Windows 10 Using XAMPP

To run a simple PHP file, we need to set up a server because of PHP is a backend language. It also needs to set up a database/FTP clients if its a PHP project.

Running a PHP file/application on the Windows operating system is much simpler using XAMPP. It contains an apache server, Mysql database, FTP, etc.

Here we are going to discuss the steps of installation of XAMPP on Windows 10 and running a simple PHP file using it.

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 link below.

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

Download the latest version (7.3.3/PHP 7.3.3).

Screenshots of the installation steps are shown below.

Image is loading...

 

Now start the Apache and MySQL.

2. CREATING DATABASE (IF OUR PHP APP NEEDS A DATABASE)

This is an optional step and only need if our PHP project needs a database. Creating a MySQL database can be easily done using phpMyAdmin.

  • Open the link below.
    http://localhost/phpmyadmin

     

  • Now Enter username and password(As a default, the username will be root password will be empty).
  • Click on the New tab
  • Enter a database name

Press Create

Image is loading...

It also needs to configure the database details in our PHP project.

3. PASTE/CLONE OUR PHP FILE/PROJECT TO HTDOCS DIRECTORY

htdocs is the directory that the Apache web server looks for files to serve on our domain by default. This location can be changed later to whatever value we want. But now, we have to paste/clone our PHP file or project to this directory. Default htdocs directory location is shown below.

C:\xampp\htdocs

4. RUNNING OUR PHP FILE/ PROJECT

Now its time to run our PHP file. https://localhost direct to our apache2 home page http://localhost/MyApp.php runs the MyApp.php file inside htdocs directory.

Note: As an example, I have chosen MyApp.php as a sample PHP file and MyPHPProject as a sample PHP project.

http://localhost/MyApp.php

If it’s a PHP project inside a directory, change the URL path.

http://localhost/MyPHPProject/MyApp.php

If our PHP project contains an index.php file in its root, It does not need to enter the file name. The below URL runs our PHP project.

http://localhost/MyPHPProject

Have a nice code !

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.
Website https://syam.me

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.

Back To Top
%d bloggers like this: