To install WordPress on XAMPP, you download XAMPP from Apache Friends, start Apache and MySQL from the control panel, create an empty database in phpMyAdmin, unzip WordPress into the htdocs folder, and run the WordPress installer at http://localhost/wordpress. The whole thing takes about fifteen minutes on Windows or macOS and gives you a local site where you can test themes, plugins and updates without touching a live server.
http://localhost/phpmyadmin and create a database called wordpress with the utf8mb4_unicode_ci collation, extract the WordPress zip into C:\xampp\htdocs\wordpress (Windows) or /Applications/XAMPP/htdocs/wordpress (macOS), then visit http://localhost/wordpress and enter database name wordpress, user root, an empty password and host localhost.This guide covers the full path: getting XAMPP running, the database step, the two ways to configure wp-config.php, the install wizard, where htdocs lives on each operating system, the port 80 conflicts that stop Apache from starting, enabling pretty permalinks with mod_rewrite, and finally how to move the finished site to real hosting.
Step 1: Download and install XAMPP
Get the installer from the official Apache Friends site. Pick the build for your operating system and, if several PHP versions are listed, choose the newest one that WordPress supports; WordPress publishes its minimum and recommended PHP versions on its Requirements page and the current line of PHP 8 is safe.
On Windows, run the installer and accept the defaults. Windows Defender may warn about User Account Control; the installer suggests avoiding C:\Program Files for that reason, so leave the target as C:\xampp. On macOS, you get a choice between the classic installer and XAMPP VM. The classic installer is simpler for WordPress because it puts files in /Applications/XAMPP/htdocs where you can edit them directly. The VM version mounts htdocs as a volume you have to open from the Volumes tab first.
Step 2: Start Apache and MySQL
Open the XAMPP Control Panel (on macOS it is the manager-osx app in /Applications/XAMPP). Click Start next to Apache and next to MySQL. Both rows should turn green and show port numbers, normally 80 and 443 for Apache and 3306 for MySQL. Open http://localhost in a browser; the XAMPP dashboard confirms the web server is up.
If Apache refuses to start, jump to the port 80 section below before doing anything else. That single problem accounts for most failed XAMPP installs.
Step 3: Create the database in phpMyAdmin
- Open
http://localhost/phpmyadmin. XAMPP logs you in automatically asrootwith no password. - Click Databases in the top menu.
- Under Create database, type a name such as
wordpress. - In the collation dropdown pick
utf8mb4_unicode_ci. - Click Create.
Leave the database empty. WordPress creates its tables during the install. Using root with an empty password is fine on a local machine that nobody else can reach, and it is what XAMPP expects. Do not carry that habit over to a live server.
Step 4: Put WordPress in htdocs
Download the latest zip from wordpress.org. Extract it and copy the inner wordpress folder into XAMPP’s web root. The location depends on the OS:
| System | htdocs path | Site URL |
|---|---|---|
| Windows | C:\xampp\htdocs\wordpress | http://localhost/wordpress |
| macOS (classic installer) | /Applications/XAMPP/htdocs/wordpress | http://localhost/wordpress |
| macOS (XAMPP VM) | Mounted volume lampp/htdocs/wordpress | http://localhost:8080/wordpress by default |
| Linux | /opt/lampp/htdocs/wordpress | http://localhost/wordpress |
You can rename the folder to anything, for example mysite, and the URL changes to match.
Step 5: Configure wp-config.php
You have two options. The easy one is to let the install wizard write the file for you. Visit http://localhost/wordpress, choose a language, click Let’s go, and fill in the form with database name wordpress, username root, password left blank, host localhost and the default wp_ prefix. On Windows the wizard can usually write wp-config.php itself; on macOS it sometimes cannot because of folder permissions and will show you the file contents to paste manually.
The manual route is to copy wp-config-sample.php to wp-config.php and edit the database block yourself:
define( 'DB_NAME', 'wordpress' );
define( 'DB_USER', 'root' );
define( 'DB_PASSWORD', '' );
define( 'DB_HOST', 'localhost' );
define( 'DB_CHARSET', 'utf8mb4' );
define( 'DB_COLLATE', '' );
/* Local development helpers */
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'FS_METHOD', 'direct' );Replace the authentication salts with fresh values from the WordPress secret key service linked in the sample file. FS_METHOD set to direct stops WordPress from asking for FTP credentials when you install plugins locally, and the debug constants write PHP notices to wp-content/debug.log instead of the screen.
sudo chmod -R 777 /Applications/XAMPP/htdocs/wordpress. That is far too permissive for a server but harmless for a local sandbox, and it also lets the WordPress updater and plugin installer work without prompts.Step 6: Run the install wizard
Once the database connection succeeds, click Run the installation. Enter a site title, an admin username (anything except admin is a good habit), a password and an email address. The Search engine visibility checkbox does not matter on localhost. Click Install WordPress, then Log In, and you land in the dashboard at http://localhost/wordpress/wp-admin.
If you have installed WordPress on other local stacks before, the flow is identical to our general WordPress on a local host guide; XAMPP just changes where the files live and how you start the services.
Fixing port 80 conflicts
Apache binds to port 80, and on Windows something else often already has it. The XAMPP control panel log will say “Port 80 in use by” followed by a process name, or simply that Apache shut down unexpectedly. The common culprits are Skype, IIS or the World Wide Web Publishing Service, the Web Deployment Agent, SQL Server Reporting Services, and VMware or Docker port forwards. On macOS the built in Apache (apachectl) or a running Docker container is the usual cause.
You have two fixes. The first is to stop whatever holds the port. On Windows, find it with:
netstat -ano | findstr :80
tasklist /FI "PID eq 1234"Then stop the service under Services or with net stop W3SVC for IIS. On macOS run sudo apachectl stop and check sudo lsof -i :80.
The second fix is to move XAMPP’s Apache to another port. Click Config next to Apache in the control panel, open httpd.conf, and change both the Listen 80 line and the ServerName localhost:80 line to 8080. Save, restart Apache, and use http://localhost:8080/wordpress from then on. Do this before running the WordPress installer if you can, because WordPress stores the site URL in the database and changing it later means editing siteurl and home in wp_options.
Permalinks and mod_rewrite
Pretty permalinks such as /2026/09/my-post/ need Apache’s mod_rewrite module and an .htaccess file in the WordPress folder. XAMPP ships with mod_rewrite enabled and AllowOverride All set for htdocs, so it normally works out of the box. Go to Settings, then Permalinks, choose Post name, and save. WordPress writes this .htaccess:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
# END WordPressIf posts return 404 after that, open httpd.conf and confirm the line LoadModule rewrite_module modules/mod_rewrite.so is not commented out with a leading #, and that the <Directory "C:/xampp/htdocs"> block contains AllowOverride All. Restart Apache after any change.
Moving the site to live hosting
A local XAMPP site is meant to graduate. The manual migration has four parts, and the process is the reverse of the one described in our manual WordPress backup guide.
- Export the database. In phpMyAdmin select the
wordpressdatabase, click Export, keep the Quick method and SQL format, and save the file. - Copy the files. Upload everything in the WordPress folder to the host’s web root with SFTP or the host’s file manager. On cPanel hosts that is usually
public_html. - Create the live database. Make a database and a user with a real password in the host’s control panel, import the SQL file, and update
DB_NAME,DB_USER,DB_PASSWORDandDB_HOSTinwp-config.php. - Replace the URL. Every
http://localhost/wordpressreference in the database needs to becomehttps://yourdomain.com. Use WP CLI’swp search-replaceon the host, or a search and replace plugin, because serialized data breaks with a plain SQLREPLACE.
wp search-replace 'http://localhost/wordpress' 'https://yourdomain.com' --all-tables --precise
wp rewrite flushRemove WP_DEBUG and FS_METHOD from the live config, resave permalinks once, and check that the uploads folder is writable. If a plugin misbehaves after the move and locks you out of the dashboard, our guide on disabling a WordPress plugin from cPanel shows how to switch it off without logging in.
wp-config.php with root and an empty password to a live server, and never leave XAMPP’s phpMyAdmin exposed on a machine that is reachable from the internet. XAMPP is a development tool with security deliberately switched off.Troubleshooting
Error establishing a database connection
MySQL is not running, the database name is misspelled, or you set a password for root that does not match wp-config.php. Check the control panel shows MySQL green, open phpMyAdmin to confirm the database exists, and compare the four DB_ constants character by character.
Apache starts and immediately stops
Port 80 or 443 is taken. Read the control panel log for the process name and either stop it or change Listen in httpd.conf as described above. On Windows, run the control panel as administrator if Apache also fails to install as a service.
MySQL shuts down unexpectedly
Usually another MySQL or MariaDB instance owns port 3306, or the data directory was corrupted by an unclean shutdown. Stop the other instance, or rename xampp/mysql/data to data_old, copy xampp/mysql/backup to data, and then copy your database folders and the ibdata1 file back from data_old.
Pages other than the home page return 404
mod_rewrite is disabled or .htaccess is not being read. Uncomment the rewrite module in httpd.conf, confirm AllowOverride All, restart Apache and resave permalinks.
Uploads fail or plugins ask for FTP details
PHP cannot write to the WordPress folder. Add define( 'FS_METHOD', 'direct' ); to wp-config.php and, on macOS or Linux, loosen the folder permissions or change the owner to the user Apache runs as.
Frequently asked questions
Is XAMPP safe to run on my main computer?
It is safe as long as you treat it as a sandbox. XAMPP binds to all network interfaces and ships with no MySQL root password, so anyone on the same Wi-Fi could in principle reach it. Keep your OS firewall on, stop the services when you are not using them, and never expose the machine directly to the internet.
Can I run more than one WordPress site on XAMPP?
Yes. Create a separate database for each site and a separate folder inside htdocs, then run the installer for each one. If you prefer proper domain names such as site1.local, add virtual hosts in httpd-vhosts.conf and matching entries in your hosts file.
Which PHP version does XAMPP use, and can I change it?
Each XAMPP build bundles one PHP version, shown in the installer name and on the dashboard. XAMPP does not switch versions in place; to change PHP you install a different XAMPP build alongside or in place of the current one. Check the WordPress Requirements page before choosing, and prefer the newest supported PHP 8 release.
Why does WordPress load slowly on XAMPP?
On Windows, the common cause is Windows Defender scanning every PHP file on each request; add the XAMPP folder to the exclusions list. Also confirm that DB_HOST is localhost or 127.0.0.1; an IPv6 lookup delay on some systems makes each page wait before connecting to MySQL.
The bottom line
Installing WordPress on XAMPP is four moves: start Apache and MySQL, create a database in phpMyAdmin, drop WordPress into htdocs, and run the installer with root and an empty password. Most failures trace back to port 80 being taken or mod_rewrite being off, and both take a minute to fix once you know where to look.
Use the local site for what it is good at: testing updates, trying themes and breaking things without consequences. When it is time to go live, export the database, upload the files, replace the localhost URL properly, and tighten the credentials you deliberately left loose on your own machine.
About this article: GeekBlog covers U.S. technology news, AI, phones, smartwatches and gaming. Every story is written and checked under our Editorial Policy. Spotted a mistake or have a story tip? Contact our editors.

