In this tutorial we will show you the solution of how to use XAMPP for PHP and MySQL, for this first you have to download Xampp from its official website that is https://www.apachefriends.org/download.html.
As, we know xampp stands for cross platform OS, apache web server, MySQL database, PHP and Perl language.
So, it has all its inbuilt feature or say dependencies if we want to use PHP with database that is MySQL.
Step By Step Guide On How To Use XAMPP For PHP And Mysql :-
- First download xampp software for your operating system.
- Then starts its installation and Run setup.
- Click next and enter required path for installation.
- Check your requirements and install.
Now, after installation you will see a xampp folder in your directly which you fill at installation time. Whereas if you did not change path, it will create a folder named xampp in C directory.
Here, you we see folders with name htdocs, php and MySQL from many.
- The htdocs is web root directory where we have to place all our php files.
- Next is MySQL which have all the information regarding our database.
- And last is PHP, which includes all the required files of PHP like php.ini file.
Now, let us learn about our Xampp Control Panel.
- To open Xampp Control Panel, just click on start menu.
- And search for xampp control panel, you can also find it under apache and then xampp.
- Now, after click it will open and you will see 5 options their like apache, MySQL, Filezilla, Mercury and Tomcat.
- You just have to click on start in front of apache and MySQL and you will see a green tick after successful starting.
- Whereas the right panel contains utilities, we will learn about them later.
- The downward section show the details which you interact with above options, for example when you start your local server that is apache then you can see the details given below.
At next step, now we are ready to create our first php file and database also. Let us learn about our database first.
- To access our database, after starting apache and MySQL form xampp control panel just see your port number and search for localhost on your preferred browser.
- If your port number change from default then you have to search for localhost:port_number.
- Now, your database MySQL gets opened to create custom database and tables.
To know about how to create PHP files.
- First step is to open our code editor or IDE in which we want to write code.
- Let us assume we opened Visual Studio code.
- At Next step, create your php file and save it using CTRL+S with extension .php.
- One thing which is main is that we have to save or place our php file that have .php extension in our htdocs folder inside xampp. This is the only way with help of which we can access of data or php files in browser.
- Now, open browser and search for localhost/your_file_name. You don’t have to use .php here with your_file_name. If you place file inside some folder in htdocs then search for localhost/folder_name/your_file_name.
- If your port number is changed then you also have to use port number like localhost:port_number/your_file_name or localhost:port_number/folder_name/your_file_name.
At last in conclusion, here we can say that with the help of this article we are able to understand how to use xampp for php and MySQL in php.
I hope this tutorial on how to use XAMPP for PHP and MySQL helps you and the steps and method mentioned above are easy to follow and implement.