Change the Default Folder in XAMPP and Link to phpMyAdmin and php.ini – AComplete Guide

When working with XAMPP, you might find the need to change the default folder to suit your project setup better. In this blog post, we'll guide you through the process of changing the default folder and adding links to phpMyAdmin and the php.ini page directly from your index.php file.

Step 1: Changing the Default Folder in XAMPP

To change the default folder in XAMPP, follow these simple steps:

  1. Stop Apache: Open the XAMPP Control Panel and click the "Stop" button next to Apache.
  2. Open the Configuration File: Click the "Config" button next to Apache and select "Apache (httpd.conf)" from the dropdown menu.
  3. Edit the Configuration File: Open the httpd.conf file in a text editor. Look for the lines that define the DocumentRoot and <Directory> entries. They will look something like this:
DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">
        
  1. Change the Paths: Update the paths to point to your new desired directory. For example, if your folder is located at C:/Users/YourUsername/Desktop/SPECIFICFOLDER, change the lines to:
DocumentRoot "C:/Users/YourUsername/Desktop/SPECIFICFOLDER"
<Directory "C:/Users/YourUsername/Desktop/SPECIFICFOLDER">
        
  1. Save the Changes: Save the httpd.conf file and close the text editor.
  2. Restart Apache: Go back to the XAMPP Control Panel and click the "Start" button next to Apache.
  3. Verify the Changes: Open your web browser and go to http://localhost/. You should see the contents of your new directory instead of the default XAMPP welcome page.

Step 2: Linking phpMyAdmin and php.ini in index.php

Now that you have set up your new directory, let's add links to phpMyAdmin and the php.ini page from your index.php file.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>My Project</title>
</head>
<body>
    <h1>Welcome to My Project</h1>
    <p>This is the homepage for my project.</p>
    
    <!-- Link to phpMyAdmin -->
    <a href="http://localhost/phpmyadmin" target="_blank">Go to phpMyAdmin</a>
    
    <!-- Link to php.ini (assuming it's located at a specific path) -->
    <a href="file:///C:/xampp/php/php.ini" target="_blank">Open php.ini</a>
</body>
</html>
        

In this example, the link to phpMyAdmin points to http://localhost/phpmyadmin, and the link to php.ini points to the file path file:///C:/xampp/php/php.ini.

Optionally, Use Buttons Instead of Links

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>My Project</title>
</head>
<body>
    <h1>Welcome to My Project</h1>
    <p>This is the homepage for my project.</p>
    
    <!-- Button to phpMyAdmin -->
    <button onclick="window.open('http://localhost/phpmyadmin', '_blank')">Go to phpMyAdmin</button>
    
    <!-- Button to php.ini -->
    <button onclick="window.open('file:///C:/xampp/php/php.ini', '_blank')">Open php.ini</button>
</body>
</html>
        

This example uses buttons to open the links in new tabs.

Finding the Path to Your Specific Document

Depending on your operating system, you can find the path to your specific document using different methods:

Windows:

  1. Open File Explorer and navigate to the folder containing your document.
  2. Click the address bar at the top of the window. It will show the path to the folder.
  3. Copy the path and append the document's name (e.g., C:/Users/YourUsername/Desktop/SPECIFICFOLDER).

Linux:

  1. Open a terminal window.
  2. Use the cd command to navigate to the folder containing your document (e.g., cd ~/Desktop/SPECIFICFOLDER).
  3. Use the pwd command to print the current working directory.
  4. Copy the path displayed in the terminal and append the document's name.

Mac:

  1. Open Finder and navigate to the folder containing your document.
  2. Right-click (or Control-click) on the document and select "Get Info".
  3. In the "Get Info" window, look for the "Where" field to see the path.
  4. Copy the path and append the document's name.

Conclusion

Changing the default folder in XAMPP and adding links to phpMyAdmin and php.ini can streamline your workflow and make accessing these tools more convenient. By following the steps outlined in this blog post, you'll be able to customize your XAMPP setup to better suit your needs.

0 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *


You may like to read


Follow Us

Sponsored Ads

GranNino Ads

Newsletter

Subscribe to our Newsletter to read our latest posts at first

We would not spam your inbox! Promise
Get In Touch

© Fullstack Coding Tips. All Rights Reserved.