How to Install WordPress on XAMPP
To install WordPress on XAMPP, start Apache and MySQL in the XAMPP Control Panel, create a database in phpMyAdmin, unzip WordPress into a folder inside htdocs, then open http://localhost/yourfolder and enter the database name, user root and a blank password. It worked when the WordPress dashboard loads.
For beginners, students and developers who want a free offline WordPress site on their own computer for building and testing.
knowledge
- Read time
- 5 min
- Sections
- 8
- Updated
- 14 Nov 2026
- Written by
- WebJi® team
Last editorial update: 14 November 2026.
What is XAMPP, and when should you use it for WordPress?
XAMPP is a free local server bundle from Apache Friends that installs Apache, MariaDB (shown as "MySQL"), PHP and phpMyAdmin on your own computer, so WordPress can run offline for building and testing. It is not meant for public websites.
| Point | XAMPP locally | Live hosting |
|---|---|---|
| Who can reach it | Only your computer | Anyone on the internet |
| Database login | root with a blank password | Separate user with a strong password |
| PHP version | Whatever that XAMPP build ships | Chosen per site in the panel |
| Caching, CDN, SSL | None by default | Server cache, CDN and free SSL |
| Use for | Building, learning, testing plugins and themes | Real visitors |
Because PHP versions and caching differ, a site that works in XAMPP can still behave differently on a host. Treat it as a workshop, not proof.
How do you install XAMPP and start Apache and MySQL?
Download a build with PHP 8.2 or newer from apachefriends.org, install it with Apache, MySQL, PHP and phpMyAdmin selected, then click Start beside Apache and MySQL in the XAMPP Control Panel. Both turn green when running.
- Run the installer and keep the default location (
C:\xamppon Windows). - Open the XAMPP Control Panel and start Apache, then MySQL.
- Open
http://localhost; the XAMPP dashboard confirms Apache is serving. - Open
http://localhost/phpmyadminto confirm the database is up.
On Linux, the stack is controlled with sudo /opt/lampp/lampp start. If Apache flashes green and stops, another program holds port 80; see the errors table below.
How do you create the WordPress database in phpMyAdmin?
In phpMyAdmin open Databases, enter a name such as wp_local, choose the utf8mb4_unicode_ci collation and click Create. Locally, XAMPP's root account with no password is enough.
utf8mb4 stores every Unicode character, including Devanagari text and emoji, which older utf8 settings cannot. Give each local site its own database and folder so testing one never touches another. If you prefer the command line, run mysql -u root -e "CREATE DATABASE wp_local CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" from XAMPP's shell.
Where do the WordPress files go in XAMPP?
Put WordPress in a folder inside htdocs, XAMPP's web root; a folder named mysite becomes http://localhost/mysite. wp-admin, wp-content and index.php must sit directly inside that folder.
| System | htdocs path |
|---|---|
| Windows | C:\xampp\htdocs\ |
| macOS | /Applications/XAMPP/htdocs/ |
| Linux | /opt/lampp/htdocs/ |
Download latest.zip from WordPress.org and extract it so you get htdocs/mysite/wp-admin, not htdocs/mysite/wordpress/wp-admin; the extra level puts the site one folder too deep.
How do you run the WordPress installer on localhost?
Open http://localhost/mysite, enter database wp_local, user root, an empty password and host localhost, then set the site title and admin login. The install is done when the dashboard loads.
- Choose a language, then enter the database details above and keep the table prefix
wp_. - If WordPress cannot write wp-config.php, it shows the contents; create the file in the site folder, paste and save.
- Set a site title, an admin username that is not "admin", a strong password and your email.
- Log in at
http://localhost/mysite/wp-admin.
Apache and MySQL must be started again after each reboot. Next steps such as themes are in installing a WordPress theme.
How do you fix common XAMPP errors?
Most XAMPP problems are port conflicts or low PHP limits, each fixed in one configuration file opened from the Control Panel's Config button. Restart the service after every change.
| Symptom | Cause | Fix |
|---|---|---|
| Apache will not start | Port 80 or 443 used by IIS, Skype or another server | Stop that program, or set Listen 8080 in httpd.conf and use localhost:8080 |
| MySQL stops immediately | Port 3306 used by another MySQL install | Stop the other service, or change the port in my.ini |
| Upload fails at 2 MB or so | Low PHP upload limits | Raise upload_max_filesize and post_max_size in php.ini |
| Plugin or import times out | Short max_execution_time | Raise it in php.ini |
| Database connection error | MySQL not running, or wrong name | Start MySQL; check the name in wp-config.php |
On Windows, netstat -ano | findstr :80 shows which process ID holds port 80.
How do you move a XAMPP WordPress site to live hosting?
Export the database, upload the files, import the database on the host, then replace every http://localhost/mysite reference with your real https address using a serialisation-safe tool. Skipping the replacement leaves a live site that redirects to localhost.
# on the server, from the site folder, after importing the SQL file
wp search-replace 'http://localhost/mysite' 'https://example.in' --all-tables --skip-columns=guid
wp option get siteurl
Then update the database name, user and password in wp-config.php and resave permalinks. A migration plugin can do the whole move instead. A small site fits WebJi® WordPress hosting, and the WordPress migration guide covers moves between live hosts.
Frequently asked questions
Is XAMPP safe to use?
On your own computer, yes. Its defaults, such as a blank database root password, assume nobody else can reach it. Never expose XAMPP to the internet or a shared office network without setting passwords and restricting access.
Should I use XAMPP or LocalWP for WordPress?
LocalWP is built only for WordPress and creates sites in a few clicks with per-site PHP versions. XAMPP is general-purpose and teaches how Apache, PHP and MySQL fit together. Both are free; choose by whether you want simplicity or a full stack to learn.
Can other people see my XAMPP site?
Not by default. localhost is reachable only from your computer. To show a client, upload the site to a staging subdomain on real hosting rather than opening ports on your machine.
Why does my local site look different on the host?
Different PHP versions, server caching, file permissions or URLs not fully replaced are the usual causes. Match the host's PHP version in your local setup, purge caches after upload and recheck the site URL settings.
Steps checked against Apache Friends and WordPress.org documentation · Reviewed by the WebJi® team, Jaipur.
Ready to get started with WebJi®?
Join 12,000+ businesses across India and overseas. INR pricing, 18% GST shown before payment and 24/7 email support in Hindi and English — average first reply under 60 minutes.