India English
Kenya English
United Kingdom English
South Africa English
Nigeria English
United States English
United States Español
Indonesia English
Bangladesh English
Egypt العربية
Tanzania English
Ethiopia English
Uganda English
Congo - Kinshasa English
Ghana English
Côte d’Ivoire English
Zambia English
Cameroon English
Rwanda English
Germany Deutsch
France Français
Spain Català
Spain Español
Italy Italiano
Russia Русский
Japan English
Brazil Português
Brazil Português
Mexico Español
Philippines English
Pakistan English
Turkey Türkçe
Vietnam English
Thailand English
South Korea English
Australia English
China 中文
Somalia English
Canada English
Canada Français
Netherlands Nederlands

How to Host a Website Using XAMPP on Your Local PC

We are Hiring!

We are looking for an experienced SEO writer and copywriter to join us at Cloudoon

You can build and test your website on your own computer without paying for hosting. 

This is useful when you want to practice, learn, or fix your site before going live. 

Many beginners struggle because the web hosting xampp setup looks hard or they see strange error messages. 

Do not worry. This guide shows every step in clear and simple English.

We will use XAMPP. It is a free tool that turns your computer into a small server. 

You can use it to test WordPress, practice PHP, or build any website. It works without the internet once installed.

Here is what you will learn:

  • Why XAMPP is good for local testing
  • What you need before installing
  • How to download and install XAMPP
  • How to start and configure services
  • How to create a database
  • How to host your files
  • How to test your site
  • How to fix common issues
  • How to move your site to online hosting

Let us begin.

I. What Is XAMPP

web hosting xampp

XAMPP is a free package that includes Apache, MySQL, PHP, and phpMyAdmin. 

These tools help you build and run websites. Apache shows your pages, MySQL stores your data, and PHP handles your code. 

You can install XAMPP on Windows, macOS, or Linux.

With XAMPP you can:

  • Build websites without internet
  • Test themes and plugins safely
  • Learn web development at no cost
  • Make changes quickly because pages load faster on your computer

Why Use XAMPP for Local Development

  1. Fast speed: Pages load very fast because everything runs on your computer.
  2. Save money: You do not need to pay for hosting while learning or testing.
  3. Safe testing: You can test risky plugins or updates without damaging your live site.

Keep in mind XAMPP is for local work. It is not safe for public use. When ready to go online, use real hosting.

II. Prerequisites For Web Hosting XAMPP

Before you install XAMPP, your computer must meet a few basic needs. 

This helps XAMPP run smoothly and prevents errors during setup. 

Here is everything you should check first.

1) Check Your Operating System

XAMPP works on three main systems:

  • Windows: Works best with Windows 10 or Windows 11.
  • macOS: Use macOS Ventura or a newer version.
  • Linux: Use Ubuntu 22 or newer.

Older systems may still run XAMPP but can be slow or cause errors. If possible, update your system first.

2) Check Your Computer Hardware

You do not need a powerful computer, but these minimum levels help XAMPP run without freezing:

  • RAM: At least 4GB. If you have 8GB or more, XAMPP will run smoother.
  • Storage space: At least 2GB free for XAMPP and your website files.
  • Processor: Any modern dual-core processor works.

If your computer is slow, close other apps while running XAMPP.

3) Make Sure You Have Internet for the Download

You only need internet to download the installer. The file is about 150–160 MB, which takes a few minutes on a normal home connection.

After installing XAMPP, you can work offline.

4) Choose a Good Browser for Testing

Use a modern browser because it loads local sites correctly:

  • Google Chrome
  • Mozilla Firefox

These browsers also work well with phpMyAdmin and WordPress installers.

5) Check for Software That May Block XAMPP

Some programs can stop Apache or MySQL from starting. Check these before installing:

Antivirus Software
Antivirus tools sometimes block XAMPP files by mistake.
Pause your antivirus during installation, then turn it back on later.

Apps Using Port 80 or 443
Apache uses port 80 and 443. Some apps use these ports too, such as:

  • Skype
  • Zoom
  • IIS (Internet Information Services)
  • Some VMware tools

Close them before installation to avoid errors.

6) Windows Users: Turn Off User Account Control (UAC) Temporarily

On Windows, UAC can block parts of XAMPP during installation.
To avoid this:

  1. Open the Start Menu.
  2. Search for “User Account Control”.
  3. Open the settings.
  4. Move the slider to the lowest level.
  5. Turn it back on after installing XAMPP.

7) Make Sure Your Firewall Will Not Block Apache

Windows Defender may block Apache the first time it tries to run.

You will see a pop-up asking if you want to allow Apache.
Click Allow for private networks (for home or office Wi-Fi).

8) Quick Summary Table

ItemWhy You Need ItTip
OSXAMPP requires a modern systemWindows 10 or 11 works well
RAM & StorageSmooth performanceClose other apps
BrowserFor testing your siteUse Chrome
InternetTo download installerTurn off other downloads
PortsRequired for ApacheFree port 80 and 443
AntivirusMay block filesPause during install

III. Downloading and Installing XAMPP

Follow these steps to install XAMPP correctly.

web hosting xampp

Step 1: Download XAMPP

Go to the official website apachefriends.org. Download the version for your system. 

Most users should choose the Windows installer with PHP 8.2 because it supports modern themes and plugins.

Step 2: Install XAMPP

  1. Open the downloaded file.
  2. Click Next on the setup screens.
  3. Choose Apache, MySQL, PHP, and phpMyAdmin.
  4. Use the default installation folder (C:\xampp).
  5. Wait for the installation to finish.

Step 3: Complete the Setup

XAMPP may ask for firewall permissions. Allow Apache on private networks so it can run. 

After installation, open the XAMPP Control Panel. If Apache and MySQL show green, you are ready to continue.

Typical installation times:

OSFile TypeTime Needed
Windowsexe5 to 7 minutes
macOSdmg4 to 6 minutes
Linuxrun6 to 8 minutes

IV. Starting and Configuring XAMPP Services

XAMPP uses modules to run your local server. The main ones are Apache and MySQL.

Step 1: Open Control Panel

Open XAMPP Control Panel from your desktop or start menu.

Step 2: Start Apache and MySQL

Click Start next to Apache. Then click Start next to MySQL. When they turn green, they are running.

If you see errors, do not panic. It is usually a port issue.

Step 3: Fix Port Problems

If Apache fails to start, another program may be using port 80. Try the following:

  1. Close Skype, Zoom, or any program using ports.
  2. Change the Apache port from 80 to 8080 in the httpd.conf file.
  3. Restart Apache.

To test, open your browser and visit:

  • http://localhost
    or
  • http://localhost:8080 (if you changed the port)

Step 4: Set Simple Settings

  • Turn on SSL if needed.
  • Allow MySQL to start with your computer.
  • Set a MySQL root password such as xampp2025.

V. Setting Up a Database

Most dynamic sites like WordPress or online shops need a database.

Step 1: Open phpMyAdmin

Visit http://localhost/phpmyadmin. This is where you create and manage your databases.

Step 2: Create a Database

  1. Click Databases.
  2. Enter a name such as mysite or wp_local.
  3. Choose utf8mb4_unicode_ci.
  4. Click Create.

This format supports many languages, including Swahili, Kikuyu, and Somali.

Database Use Cases

TypeUseExample
MySQLWordPressBlog or store
MariaDBE-commerceInventory data
NoneStatic sitesPortfolio

VI. Hosting Your Website Files

Your website files go inside the htdocs folder.

web hosting xampp

Step 1: Open htdocs

In the Control Panel, click Explorer and open the htdocs folder. This is the root folder for your websites.

Step 2: Add Your Website

Create a new folder. For example, name it myshop. Add your HTML, CSS, JS, or PHP files inside this folder.

WordPress Setup Steps

  1. Download the latest WordPress ZIP file.
  2. Extract it inside htdocs/myshop.
  3. Copy wp-config-sample.php and rename it to wp-config.php.
  4. Add your database name, username, and password.

Example settings:

define(‘DB_NAME’, ‘myshop’);

define(‘DB_USER’, ‘root’);

define(‘DB_PASSWORD’, ”);

define(‘DB_HOST’, ‘localhost’);

$table_prefix = ‘wp_’;

Step 3: View Your Site

Visit:
http://localhost/myshop

If you changed your Apache port, visit:
http://localhost:8080/myshop

WordPress will ask you to complete the setup. Follow the steps and create an admin account.

VII. Testing Your Local Website

Testing helps you confirm that everything works well.

Basic Test for PHP

Create a file named test.php inside your folder:

<?php echo “Hello from XAMPP”; ?>

Visit http://localhost/myshop/test.php. If you see the message, PHP works.

Testing WordPress

  1. Login at /wp-admin
  2. Create a test post
  3. Upload an image
  4. Install a plugin
  5. Check if your site loads on your phone while connected to the same network

VIII. Troubleshooting Common Issues

Here are common problems and fixes.

Apache or MySQL Not Starting

Check port usage:

  • Close programs using port 80
  • Change Apache to port 8080
  • Add Apache to Windows Defender allow list

403 Forbidden Error

Make sure your folder permissions allow access. Update httpd-xampp.conf if needed.

Upload File Too Large

Open php.ini and increase:

  • upload_max_filesize
  • max_execution_time

Restart Apache.

Website Crashes After Plugin Installation

Check WordPress logs in wp-content/debug.log. Remove the plugin folder inside wp-content/plugins if the site breaks.

IX. Best Practices and Going Live

Once your website works well on XAMPP, you can follow these best practices to keep everything clean, fast, and ready for real hosting.

Improve Performance

Good performance makes your local website load faster and helps you work without delays. Here are simple ways to do that:

1) Turn On Gzip Compression in Apache

Gzip compression makes your pages smaller. This helps them load faster in your browser.

To enable it:

  1. Open the Apache “httpd.conf” file from the XAMPP Control Panel.
  2. Search for the line that says “mod_deflate”.
  3. Make sure it is not disabled.
  4. Save the file, then restart Apache.

This is very helpful when testing large themes or images.

2) Keep Your Folders Organized

Create clear folders for each project in your htdocs directory.

This makes it easier to manage files and avoid mistakes.

For example:

  • htdocs/myshop
  • htdocs/blog
  • htdocs/portfolio

Avoid mixing files from different websites.

3) Use Simple File Names

Use short and clean names so your site loads without issues.
Good examples:

  • index.php
  • about.html
  • shop.css

Avoid names with spaces or symbols.

Moving Your Site Online

After testing on XAMPP, you can move your site to real hosting so people can see it online. 

This process is called migration. Here is a simple step-by-step path.

Steps to Move Your Site

StepWhat to DoTool
1Export your databasephpMyAdmin
2Upload your website filesFTP or File Manager
3Import the database to your hostingHosting phpMyAdmin
4Update your wp-config settingsEdit database details
5Update all URLs from localhost to your domainSearch and replace plugin

Why Use a Hosting Provider

Real hosting helps your website load faster for users. It also gives you a real domain name and full security. 

At Truehost we offer fast servers, easy setup, and local support, which makes the move from XAMPP much smoother.

Conclusion

You now know how to host a website using XAMPP on your local PC. 

You learned how to install XAMPP, set up Apache and MySQL, create a database, add your files, test your site, fix common issues, and move your site online.

XAMPP gives you a safe and free space to learn and improve before going live. 

When ready, choose a reliable hosting plan and publish your site for the world to see.

SSL COUPON Offer

Read More Posts

How to Create a Full Website Backup and Restore It

How to Create a Full Website Backup and Restore It

A website can disappear without warning. One moment everything works. The next moment the whole site is gone. …

How to Host a Static Website on GitHub Pages

How to Host a Static Website on GitHub Pages

You’re building your portfolio in Nairobi or starting a side-hustle blog, but hosting feels tricky.  Some cheap options…

Free Web Hosting and Domain Name with cPanel: Is It Worth It?

Free Web Hosting and Domain Name with cPanel: Is It Worth It?

Starting a website can feel overwhelming. You want to get online quickly, but the costs, technical setup, and…

Web Hosting Basics: Everything You Need to Know Before You Start

Web Hosting Basics: Everything You Need to Know Before You Start

When starting a website for any purpose, we encounter various terms, such as web hosting. You might have…