All TalkersCode Topics

Follow TalkersCode On Social Media - A Social Media Network for developers Join Now ➔

How To Use XAMPP For PHP And MySQL

Last Updated : Mar 11, 2024

How To Use XAMPP For PHP And MySQL

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

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 :-

  1. First download xampp software for your operating system.
  2. Then starts its installation and Run setup.
  3. Click next and enter required path for installation.
  4. 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.

  1. The htdocs is web root directory where we have to place all our php files.
  2. Next is MySQL which have all the information regarding our database.
  3. 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.

  1. To open Xampp Control Panel, just click on start menu.
  2. And search for xampp control panel, you can also find it under apache and then xampp.
  3. Now, after click it will open and you will see 5 options their like apache, MySQL, Filezilla, Mercury and Tomcat.
  4. You just have to click on start in front of apache and MySQL and you will see a green tick after successful starting.
  5. Whereas the right panel contains utilities, we will learn about them later.
  6. 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.

  1. 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.
  2. If your port number change from default then you have to search for localhost:port_number.
  3. Now, your database MySQL gets opened to create custom database and tables.

To know about how to create PHP files.

  1. First step is to open our code editor or IDE in which we want to write code.
  2. Let us assume we opened Visual Studio code.
  3. At Next step, create your php file and save it using CTRL+S with extension .php.
  4. 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.
  5. 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.
  6. 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.

Conclusion :-

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.

Author Image About Anjali

Experienced Computer Programmer with a broad range of experience in technology. Strengths in application development and Object Oriented architecture design, front end programming, usability and multimedia technology. Expert in coding languages such as C, C++ Java, JavaScript, PHP and more.

Follow Anjali On Linkedin 🡪