How to Install XAMPP Server on Windows 10
In order to run our PHP code we must have PHP, MySQL and Apache Server installed and configured on our system. But to make our work easier we will install a third-party software XAMPP Server. This XAMPP server will automatically install and configure all these three software’s that is, PHP, MySQL and Apache Server. All we need to do is to Download and install this XAMPP Server on our system.
Download XAMPP Server
To download a XAMPP server we need to open our web browser and search for Download XAMPP. The first that appears on your screen is from apache friends, Just click on that link, and you will see an interface like this.
Download the latest version of XAMPP server that is 8.2.4 by clicking on the Download button.
Now wait for some time until this software downloads on your system.
Install XAMPP Server
Once the downloading process is complete, now in order to install this XAMPP server on your system, open the folder where you have downloaded this software. Now open the folder and you will see a pop-up window, where it shows “Do you allow this app to make changes“. Just click on Yes and move on.
After that you will see a list of components that you are going to install
You can disable the Tomcat, because it’s used to run Java files, and click on next. Now it will show you where you want to install this software, by default the location will be C/drive, but you can change it if you want. After that it will show you “Welcome to XAMPP!” and an install button, click on it to install XAMPP server on your system.
How to Set-up XAMPP
Now you have downloaded and installed XAMPP server on your system. Now in order to work with PHP you have to set-up the XAMPP server. So to do that open the folder where you have installed your XAMPP server. Here you will see a list of files, but you have nothing to do with any file, all you need to do is to scroll down and in the bottom you will see a XAMPP control file (3rd last file with a XAMPP logo).
Double click on this file and start the Apache and MySQL file by clicking on the small start button. When the color of the both components is changed from white to green that means both are started. As shown in an image below.
NOTE:- You must start Apache and MySQL component whenever you run your PHP code, Otherwise you code will not run.
Write Your PHP Program
When you first start writing your HTML code, you simply create an html file anywhere in your system and save it with an extension of
.html. Then you open that html file in your code editor and start writing an HTML Code.
But if you want to write a PHP code, you can’t save that file anywhere in the system. You must have to create a PHP file inside a particular folder, in order to write your PHP code.
So to create a PHP File open the XAMPP server and search for a folder namely htdocs.
Now inside this htdocs folder let’s create another folder where we store our PHP File. Let’s create a folder with the name of PHPtest.
Now inside this PHPtest folder lets create a PHP file and name it first.php. (All PHP files must be saved with an extension of .php)
OK, now you have successfully created a PHP file inside the htdocs folder. Now to write a PHP code you need to open that PHP file that you have saved in the htdocs folder, on your code editor. Now inside this PHP file let’s write a simple Hello World! program.
Run Your PHP Program
As discussed earlier to run our PHP program we need to open the Apache and MySQL components in our XAMPP control panel.
Once you did it, now open your web browser and type localhost/phptest and hit enter. (phptest is the name of the folder that we have created inside the htdocs folder.)
Now click on the file first.php.
Here you can see the output of the your PHP Program. install xampp server on windows 10
Share This Post!