Close Menu
GeekBlog

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    Four Nonprofits Want a Judge to Freeze AI at Today’s Level. OpenAI, Anthropic, Google, Meta and SpaceX Are Named.

    November 14, 2026

    One UI 9 Watch Arrives on Galaxy Watch 8 in the US: What’s New in Wear OS 7 and Who Gets It Next

    November 14, 2026

    Scientists Say This Super El Niño Could Kill as Many People as a Pandemic. Here’s Where the 451,000 Number Comes From.

    November 14, 2026
    Facebook
    GeekBlog
    • Home
    • Mobile
    • Tech News
    • Blog
    • Gaming
    • Smartwatch
    • How-To Guides
    • AI & Software
    Facebook
    GeekBlog
    Home»Blog»How to Install WordPress on XAMPP (Windows and macOS)
    Blog

    How to Install WordPress on XAMPP (Windows and macOS)

    Ethan CaldwellBy Ethan CaldwellSeptember 9, 202611 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Email Copy Link
    Workspace with a laptop showing a code display for a local WordPress install on XAMPP
    Share
    Facebook Twitter LinkedIn Pinterest Email Copy Link

    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.

    Quick answer: Install XAMPP, start Apache and MySQL, open 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.

    Note: XAMPP ships MariaDB, not Oracle MySQL, even though the control panel labels the service MySQL. WordPress works with both, and the connection settings are identical.

    Step 3: Create the database in phpMyAdmin

    1. Open http://localhost/phpmyadmin. XAMPP logs you in automatically as root with no password.
    2. Click Databases in the top menu.
    3. Under Create database, type a name such as wordpress.
    4. In the collation dropdown pick utf8mb4_unicode_ci.
    5. 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:

    Systemhtdocs pathSite URL
    WindowsC:\xampp\htdocs\wordpresshttp://localhost/wordpress
    macOS (classic installer)/Applications/XAMPP/htdocs/wordpresshttp://localhost/wordpress
    macOS (XAMPP VM)Mounted volume lampp/htdocs/wordpresshttp://localhost:8080/wordpress by default
    Linux/opt/lampp/htdocs/wordpresshttp://localhost/wordpress

    You can rename the folder to anything, for example mysite, and the URL changes to match.

    Step 5: Configure wp-config.php

    Recommended for you:

    How to Use Regular Expressions in Jinja2
    Blog·Sep 9, 2026

    How to Use Regular Expressions in Jinja2

    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.

    Tip: On macOS, if the wizard reports it cannot write files, open Terminal and run 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 WordPress

    If 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.

    1. Export the database. In phpMyAdmin select the wordpress database, click Export, keep the Quick method and SQL format, and save the file.
    2. 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.
    3. 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_PASSWORD and DB_HOST in wp-config.php.
    4. Replace the URL. Every http://localhost/wordpress reference in the database needs to become https://yourdomain.com. Use WP CLI’s wp search-replace on the host, or a search and replace plugin, because serialized data breaks with a plain SQL REPLACE.
    wp search-replace 'http://localhost/wordpress' 'https://yourdomain.com' --all-tables --precise
    wp rewrite flush

    Remove 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.

    Warning: Never upload your local 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.

    Recommended for you:

    How to Implement Facebook Comment Integration on My Website (And Why You No Longer Can)
    Blog·Sep 9, 2026

    How to Implement Facebook Comment Integration on My Website (And Why You No Longer Can)

    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.

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Telegram Email Copy Link
    Previous ArticleHow to Run OpenCart on HostGator
    Next Article How to Read Chaikin Money Flow (CMF): Formula, Signals and Limits
    Ethan Caldwell

      Ethan Caldwell is GeekBlog's resident Apple specialist, covering the entire Apple ecosystem: iPhone, iPad, Mac, Apple Watch, AirPods and the software that ties them together. A longtime iOS user and gadget collector, Ethan tracks Cupertino's every move, breaking down Apple keynotes, A- and M-series chip benchmarks, iOS feature updates and the rumor mill into clear, practical takes that help readers decide whether the latest Apple hardware is worth the upgrade.

      Related Posts

      10 Mins Read

      Google Ads Keyword Planner: How It Shows the Most Relevant Keywords

      11 Mins Read

      How to Use Remarketing Techniques for Better Conversions

      11 Mins Read

      How to Conduct A/B Testing for Marketing Campaigns

      10 Mins Read

      AMP for WP Plugin Vulnerability: What Was Fixed and What to Do

      11 Mins Read

      How to Create a Facebook Business Page in 2026

      11 Mins Read

      How to Convert GMT Time to Other Time Zones in C++

      Top Posts

      Every iPhone Camera Ranked in 2026 (Best to Worst)

      July 6, 2026337 Views

      Best Browser for Android in 2026: Top Picks Ranked

      July 7, 2026267 Views

      iPhone Battery Replacement Cost: Every Model, Apple vs Repair Shop

      October 6, 2026186 Views
      Stay In Touch
      • Facebook

      Subscribe to Updates

      Get the latest tech news from FooBar about tech, design and biz.

      Most Popular

      MapQuest Now Shows the Plate Readers on Your Route. It Won’t Say Where the Map Comes From.

      October 19, 2026657 Views

      Apple Told Its Stores Not to Expect iPhone Duo Walk-Ins. Carriers Can Beat January by Weeks.

      October 20, 2026309 Views

      Apple Watch Black Friday 2026: Early Deals, Prices to Beat and When to Buy

      November 8, 2026182 Views
      Our Picks

      Four Nonprofits Want a Judge to Freeze AI at Today’s Level. OpenAI, Anthropic, Google, Meta and SpaceX Are Named.

      November 14, 2026

      One UI 9 Watch Arrives on Galaxy Watch 8 in the US: What’s New in Wear OS 7 and Who Gets It Next

      November 14, 2026

      Scientists Say This Super El Niño Could Kill as Many People as a Pandemic. Here’s Where the 451,000 Number Comes From.

      November 14, 2026

      Subscribe to Updates

      Get the latest creative news from FooBar about art, design and business.

      HEICJPG.online - Convert HEIC to JPG online
      Facebook
      • About GeekBlog: Our Mission, Team and Editorial Standards
      • Contact us
      • Privacy Policy
      • Disclaimer
      • Terms and Conditions
      • Editorial Policy
      • Cookie Policy
      • Your Privacy Choices
      © 2026 GeekBlog

      Type above and press Enter to search. Press Esc to cancel.