In this article you’ll learn how to use XAMPP to run or execute your PHP code or project.
Why do we need XAMPP?
Firstly, if you have any questions like what is XAMPP used for? or similar questions let me answer.
Let us say you want to create a dynamic website that makes use of PHP code then you require Apache server to compile your PHP code. In case you want to perform some operations related to a database such as storing data into a database or fetching data from a database. you want to have MySQL, MariaDB database functionality.
So, you need to use XAMPP to fulfill the requirements to run your PHP, Perl, and some other programming languages.
XAMPP offers the Run environment or executes codes and tasks for your PHP, Perl and some other language programming. It is open source and free to use. XAMPP was developed by Apache Friends. Includes Apache HTTP server, MySQL, PHP parser, Perl and other programming languages, Maria Api etc.
How to Run PHP Code Using XAMPP
Follow the below steps to run your PHP code or project using the XAMPP server.
Step 1: Install XAMPP
The first step is to install XAMPP onto your computer. it is very easy to install XAMPP. Just visit the official website to download XAMPP.
Apache Friends: https://www.apachefriends.org/index.html
On this site you can see XAMPP for Windows, Linux and OS X. Where you can download XAMPP based on your computer OS and after downloading install it.
Step 2: Open XAMPP control panel
After installing XAMPP on to your PC the next step is to start the Apache server and MySQL.
The control panel XAMPP which is something like this.
To launch Apache service and MySQL service, click on the Start button. if you want to stop any of the services at any time you can click on stop button in XAMPP control panel.
Step 3: Executing Project
Once the Apache and MySQL services are started and running in the background. Now extract the project zip file which you have downloaded from our site.
After extracting you should see the folder which contains all the code and related files of the project that you have downloaded.
Copy this folder and navigate to xampp folder (which is basically located in C drive) and inside this folder (xampp) find the htdocs folder and paste the project folder into this htdocs folder
In my case, the path is something like this C:xampphtdocs
After the project folder is successfully copied to the specified location on your computer. Then go to your browser (Chrome) and type in URL field: localhost/ FOLDER NAME and then hit enter.
If the project folder name is “Criminal_Mini_Project” then type in URL field: localhost/ Criminal_Mini_Project and hit enter. That’s it your project will start running.
I hope the article was useful. If you find any difficulty in running your code feel free to share your problem with us, we will try to solve it.