localhost/wordpress

http://localhost/wordpress

Install and run WordPress locally at localhost/wordpress for safe development, theme customization, plugin testing, and learning WordPress without affecting your live website or needing internet hosting.

→ Open localhost/wordpress

Why Install WordPress Locally?

Running WordPress on your local computer offers many advantages:

  • Safe Testing Environment - Test themes, plugins, and changes without breaking live site
  • No Hosting Costs - Develop and learn WordPress completely free
  • Faster Development - No internet connection needed, instant page loads
  • Easy Experimentation - Try different configurations without consequences
  • Offline Work - Develop anywhere without internet access
  • Version Control - Integrate with Git for code management
  • Client Demos - Show website prototypes locally before launch
  • Learning Platform - Perfect for WordPress beginners and training

Prerequisites for WordPress Local Installation

Before installing WordPress locally, you need:

  • Web Server: Apache or Nginx (included in XAMPP, WAMP, MAMP)
  • PHP: Version 7.4 or higher (8.0+ recommended)
  • MySQL Database: Version 5.7+ or MariaDB 10.3+
  • phpMyAdmin: For easy database management (optional but recommended)
  • Text Editor: VS Code, Sublime Text, or Notepad++ for file editing

Recommended Software Stacks:

  • Windows: XAMPP or WAMP
  • Mac: MAMP or Local by Flywheel
  • Linux: LAMP stack or XAMPP
  • Cross-Platform: Docker with WordPress image

Complete WordPress Local Installation Guide

Step 1: Install Local Server Environment

  1. Download XAMPP from apachefriends.org
  2. Run installer and follow setup wizard
  3. Install XAMPP to default location (C:\xampp or /opt/lampp)
  4. Complete installation and launch XAMPP Control Panel

Step 2: Start Apache and MySQL Services

  1. Open XAMPP Control Panel
  2. Click "Start" button next to Apache module
  3. Click "Start" button next to MySQL module
  4. Wait until both show green "Running" status
  5. If port conflicts occur, see troubleshooting section below

Step 3: Download WordPress

  1. Visit wordpress.org/download
  2. Click "Download WordPress" button
  3. Save wordpress-6.x.zip file to your computer
  4. Extract the ZIP file contents
  5. You'll see a "wordpress" folder with WordPress files

Step 4: Move WordPress to htdocs Folder

  1. Navigate to your XAMPP installation directory
  2. Open the "htdocs" folder (C:\xampp\htdocs on Windows)
  3. Copy the extracted "wordpress" folder into htdocs
  4. The path should be: C:\xampp\htdocs\wordpress\
  5. Inside should be wp-admin, wp-content, wp-includes folders

Step 5: Create MySQL Database

  1. Open browser and go to localhost/phpmyadmin
  2. Login with username: root, password: (blank)
  3. Click "New" or "Databases" in left sidebar
  4. Enter database name: wordpress_db or wp_local
  5. Select collation: utf8mb4_general_ci (recommended)
  6. Click "Create" button
  7. Database is now ready for WordPress installation

Step 6: Run WordPress Installation

  1. Open browser and navigate to: localhost/wordpress
  2. You'll see "Welcome to WordPress" installation screen
  3. Select your language and click "Continue"
  4. WordPress will ask for database connection details
  5. Click "Let's go!" to proceed to database configuration

Step 7: Configure Database Connection

  1. Enter database information from Step 5
  2. Database Name: wordpress_db (or your chosen name)
  3. Username: root (XAMPP default)
  4. Password: (leave blank for XAMPP, or "root" for MAMP)
  5. Database Host: localhost (default)
  6. Table Prefix: wp_ (default, or customize)
  7. Click "Submit" to test database connection
  8. If successful, click "Run the installation"

Step 8: Complete WordPress Setup

  1. Enter your site information:
  2. Site Title: Your website name
  3. Username: Admin username (avoid "admin" for security)
  4. Password: Strong password (WordPress will generate one)
  5. Your Email: Your email address
  6. Search Engine Visibility: Check to discourage search engines
  7. Click "Install WordPress" button
  8. Installation completes in a few seconds
  9. Click "Log In" to access WordPress admin dashboard

WordPress File Locations by Platform

XAMPP Locations

  • Windows: C:\xampp\htdocs\wordpress\
  • Linux: /opt/lampp/htdocs/wordpress/
  • Mac: /Applications/XAMPP/htdocs/wordpress/

WAMP Locations

  • 32-bit: C:\wamp\www\wordpress\
  • 64-bit: C:\wamp64\www\wordpress\

MAMP Locations

  • Mac: /Applications/MAMP/htdocs/wordpress/
  • Windows: C:\MAMP\htdocs\wordpress\

Important WordPress URLs

  • Website Frontend: http://localhost/wordpress
  • Admin Dashboard: http://localhost/wordpress/wp-admin
  • Login Page: http://localhost/wordpress/wp-login.php
  • XMLRPC: http://localhost/wordpress/xmlrpc.php
  • Admin AJAX: http://localhost/wordpress/wp-admin/admin-ajax.php

WordPress Database Configuration Settings

These settings go in wp-config.php file:

Setting XAMPP Value WAMP Value MAMP Value
DB_NAME wordpress_db wordpress_db wordpress_db
DB_USER root root root
DB_PASSWORD (blank) (blank) root
DB_HOST localhost localhost localhost
DB_CHARSET utf8mb4 utf8mb4 utf8mb4
DB_COLLATE (leave blank) (leave blank) (leave blank)

Manual wp-config.php Configuration

If you need to manually create or edit wp-config.php:

// ** MySQL settings ** // define( 'DB_NAME', 'wordpress_db' ); define( 'DB_USER', 'root' ); define( 'DB_PASSWORD', '' ); // Blank for XAMPP/WAMP, 'root' for MAMP define( 'DB_HOST', 'localhost' ); define( 'DB_CHARSET', 'utf8mb4' ); define( 'DB_COLLATE', '' ); // ** Authentication Unique Keys and Salts ** // // Generate from: https://api.wordpress.org/secret-key/1.1/salt/ define('AUTH_KEY', 'put your unique phrase here'); define('SECURE_AUTH_KEY', 'put your unique phrase here'); define('LOGGED_IN_KEY', 'put your unique phrase here'); define('NONCE_KEY', 'put your unique phrase here'); define('AUTH_SALT', 'put your unique phrase here'); define('SECURE_AUTH_SALT', 'put your unique phrase here'); define('LOGGED_IN_SALT', 'put your unique phrase here'); define('NONCE_SALT', 'put your unique phrase here'); // ** WordPress Database Table prefix ** // $table_prefix = 'wp_'; // ** For local development ** // define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false ); // ** Absolute path to WordPress directory ** // if ( ! defined( 'ABSPATH' ) ) { define( 'ABSPATH', __DIR__ . '/' ); } // ** Sets up WordPress vars and included files ** // require_once ABSPATH . 'wp-settings.php';

Common WordPress Local Development Errors

Error: "Error establishing a database connection"

WordPress cannot connect to MySQL database.

  • Check MySQL is running - Start MySQL in XAMPP Control Panel
  • Verify database exists - Check phpMyAdmin for wordpress_db
  • Check credentials - Confirm DB_USER and DB_PASSWORD in wp-config.php
  • Test database connection - Use phpMyAdmin to verify root access
  • Check DB_HOST - Should be "localhost" not "127.0.0.1" usually
  • Port conflicts - If MySQL port changed, use "localhost:3307"

Error: "404 Not Found" on localhost/wordpress

WordPress files are not in the correct location.

  • Verify wordpress folder exists in htdocs directory
  • Check Apache is running in XAMPP Control Panel
  • Ensure WordPress files are directly in wordpress folder (not wordpress/wordpress)
  • Clear browser cache and try again
  • Try accessing localhost first to test Apache

Error: "404 Not Found" on WordPress Pages/Posts

Permalink structure issue - mod_rewrite not working.

  • Go to WordPress Admin → Settings → Permalinks
  • Click "Save Changes" to regenerate .htaccess file
  • Ensure mod_rewrite is enabled in Apache httpd.conf
  • Check .htaccess file exists in wordpress root folder
  • Verify AllowOverride is set to "All" in httpd.conf
# Enable mod_rewrite in httpd.conf # Find and uncomment this line: LoadModule rewrite_module modules/mod_rewrite.so # Ensure AllowOverride is set to All: <Directory "C:/xampp/htdocs"> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory>

Error: "The uploaded file exceeds the upload_max_filesize directive"

PHP upload limits are too small for themes/plugins.

  • Edit php.ini file (click Config → PHP in XAMPP)
  • Find: upload_max_filesize = 2M
  • Change to: upload_max_filesize = 64M
  • Find: post_max_size = 8M
  • Change to: post_max_size = 64M
  • Save php.ini and restart Apache

Error: "White Screen of Death" (Blank Page)

PHP error occurring, but errors are hidden.

  • Enable WP_DEBUG in wp-config.php
  • Check PHP error logs in xampp/php/logs/
  • Increase PHP memory_limit in php.ini
  • Deactivate all plugins via phpMyAdmin
  • Switch to default WordPress theme
  • Check for syntax errors in theme functions.php

Error: "Maximum execution time exceeded"

Script takes too long to execute (common during imports).

  • Edit php.ini file
  • Find: max_execution_time = 30
  • Change to: max_execution_time = 300
  • Also increase: max_input_time = 300
  • Restart Apache after saving changes

Error: "Cannot modify header information"

Usually caused by whitespace before <?php tag.

  • Check wp-config.php for spaces before <?php
  • Verify no blank lines at end of functions.php
  • Ensure files are saved with UTF-8 encoding (no BOM)
  • Check all theme and plugin files
Quick WordPress CLI Installation (Alternative Method):
# Install WP-CLI first from wp-cli.org # Navigate to htdocs folder cd C:\xampp\htdocs # Download WordPress wp core download --path=wordpress # Create wp-config.php wp config create --dbname=wordpress_db --dbuser=root --dbpass="" --path=wordpress # Run installation wp core install --url=localhost/wordpress --title="My Local Site" \ --admin_user=admin --admin_password=password123 \ --admin_email=admin@example.com --path=wordpress # Your site is now ready at localhost/wordpress

Enable WordPress Debug Mode

For local development, enable debugging to see error messages:

// Add to wp-config.php before "That's all, stop editing!" line // Enable WP_DEBUG mode define( 'WP_DEBUG', true ); // Enable Debug logging to /wp-content/debug.log define( 'WP_DEBUG_LOG', true ); // Disable display of errors and warnings on screen define( 'WP_DEBUG_DISPLAY', false ); @ini_set( 'display_errors', 0 ); // Use dev versions of core JS and CSS files define( 'SCRIPT_DEBUG', true ); // Log database queries define( 'SAVEQUERIES', true );

Optimize WordPress for Local Development

Increase PHP Limits

// Add to wp-config.php define( 'WP_MEMORY_LIMIT', '256M' ); define( 'WP_MAX_MEMORY_LIMIT', '512M' );

Disable Auto-Updates

// Add to wp-config.php to prevent auto-updates define( 'AUTOMATIC_UPDATER_DISABLED', true ); define( 'WP_AUTO_UPDATE_CORE', false );

Disable Cron for Development

// Add to wp-config.php define( 'DISABLE_WP_CRON', true );

Migrate Local WordPress to Live Server

Steps to move your local site to production:

  1. Export database from phpMyAdmin (Export → SQL format)
  2. Use Search & Replace tool to change localhost URLs to live domain
  3. Upload WordPress files via FTP to web hosting
  4. Create new database on hosting control panel
  5. Import modified SQL file to live database
  6. Update wp-config.php with live database credentials
  7. Test site thoroughly and check all links

Recommended Migration Plugins:

  • Duplicator - Complete site migration
  • All-in-One WP Migration - Simple drag-and-drop
  • UpdraftPlus - Backup and restore
  • WP Migrate DB - Database migration specialist

WordPress Local Development Tools

Alternative Local WordPress Environments

  • Local by Flywheel - User-friendly, one-click WordPress setup
  • DevKinsta - Free local WordPress development by Kinsta
  • XAMPP - Traditional full-stack server environment
  • Docker WordPress - Containerized WordPress development
  • Vagrant + VVV - Virtual machine WordPress environment
  • Laragon - Portable, isolated, fast development environment

Useful WordPress Development Plugins

  • Query Monitor - Debug database queries and PHP errors
  • Debug Bar - Debugging toolbar for developers
  • Theme Check - Test themes for WordPress standards
  • WP-CLI - Command-line WordPress management
  • Show Current Template - Display current template file
Development Tip: Always use a child theme when customizing WordPress themes locally. This prevents losing your changes when the parent theme updates. Create a child theme with just style.css and functions.php files.

Frequently Asked Questions

Can I run multiple WordPress sites locally?

Yes! Create separate folders in htdocs (like wordpress1, wordpress2) and create separate databases for each. Access them at localhost/wordpress1 and localhost/wordpress2.

How do I access WordPress admin panel?

Go to localhost/wordpress/wp-admin or localhost/wordpress/wp-login.php and enter your username and password.

Can I use WordPress locally without internet?

Yes, once installed, WordPress works completely offline. You only need internet to download plugins/themes from WordPress.org.

How do I reset WordPress admin password locally?

Use phpMyAdmin: open wp_users table, edit admin user, set new password, select MD5 hash function, and save.

Is it safe to test plugins locally?

Absolutely! That's the best use of local WordPress. Test plugins, themes, and updates safely without risking your live site.

Related Resources