How to Run PHP File in Xampp or Wamp in Window Linux & Mac
PHP is the most well-known web backend programming language.
A PHP code will run as a web server module or as an order line interface.
To run PHP for the web, you have to introduce a Web Server like Apache and you additionally need a database server like MySQL.
There are different web servers for running PHP programs like WAMP and XAMPP.
WAMP server is upheld in windows and XAMP is bolstered in the two Windows and Linux.
Right now, I will figure out how to run a PHP program in the Xampp server.
What is Xampp?
Xampp is an Open Source web server with all the tools and language support built-in to it.
It’s available to use and executes it easier for developers to take their code and host it locally and test the same.
XAMPP stands for Cross-Platform (X), Apache (A), MariaDB (M), PHP (P) and Perl (P).
It is a simple, lightweight Apache configuration that makes it remarkably easy for developers to build a local web server for experimentation objectives.
Everything required to set up a web server application – Apache, database -MariaDB, and scripting language -PHP is involved in an extractable file.
XAMPP is also cross-platform, which means it works equally well on Linux, Mac, and Windows.
How to download and install Xampp?
You can see there is a different installation file for Windows, Ubuntu, and Mac. Download file base on your system operating system.
After download completed, Double click on the downloaded setup file to start the installation process.
if you see any warning popup so click on Ok button
Select the root folder path to set up the HTDOCS folder for our applications.
For instance “C:\xampp”
you can see the Windows firewall popup for allowing the XAMPP application in your system, click on Allow access button for access.
After that application finish wizard comes, just click the Finish button of the XAMPP.
Now you can see the XAMPP icon on the right side of the start menu.
Click on the Xampp icon to run the XAMPP on your window system.
You can see this kind of wizard, Click on the Start Button on the control panel.
How to run the PHP program in Xampp?
Go to the root folder of Xampp in your system, inside the Xampp folder you can see the htdocs folder.
Here you can have to create your project name folder like “xampp/htdocs/techpeat
inside that folder create one PHP file index.php
Write the code in index.php as per below.
echo “Hello World”;
Save this file and open your favorite web browser.
write the http://localhost/techpeat, there you can see the output of your code “Hello World”.