To run a PHP, it is enough to just install an Apache server on your local computer. In most PHP projects, MySQL is used as a database. PHPMyAdmin is required to manage the database. All are separate open-source software and installing this software one by one will be a difficult job for beginners. This is where XAMPP comes into the picture. XAMPP is an easy to install Apache distribution containing Apache web server, PHP and MySQL bundled together.
Download XAMPP from XAMPP’s official website. Select your operating system and click on the download button.
Wait a few moments after hitting the download button. Because the file is around 150 MB in size, it will take some time to download. After downloading the file, double click the executable file and follow the installation process.
Click on the Next button.
On this screen, some of the checkboxes will already be checked. It is enough to select Apache, MySQL, PHP and phpMyAdmin and click on the Next button. On the next screen, select the path where you want to install the XAMPP server. You can leave it as default c:\xampp. Click on the Next button.
Once the installation is complete, remove the tick mark “Do you want to start the control panel now?” and click on the Finish button. We have to run the XAMPP control panel as administrators.
Step 2 – Run the XAMPP server and test it
Once the XAMPP installation is complete, you will need to run XAMPP as an administrator on Windows. To do that, click Start, find XAMPP Control Panel in your Programs list, then right-click and select Run As Administrator. Another option is to go to C:/xampp where you have installed the XAMPP server, run xampp_start.exe as administrator.
This will launch the XAMPP Control Panel.
First, run Apache and MySQL services on the left side of the Control panel. Observe the green tick mark. This will register the Apache and MySQL server as service and it will start the server on every system reboot. Now click on the Start button for both Apache and MySQL which should look like the below image. You can track the green running status near to it.
Now is the time to test the XAMPP server. Open http://localhost, if everything is good then it should open the page like the below image.
Create your project folder inside C:/xampp/htdocs and upload the files. For example, create a folder called “project” inside C:/xampp/htdocs and upload a sample PHP file. Now go to the browser and open http://localhost/project. PHP file should open properly.
Creating a Database
We will create a MySQL database using the phpMyAdmin tool. Open http://localhost/phpmyadmin to launch phpMyAdmin.
Click on the tab Databases, enter the database name and click on create button. This will create a database. You can name the database whatever you want.
So, give it a shot and let me know if you have any questions in the comments section below. I’ll be happy to assist you!