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.
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
- Download XAMPP from apachefriends.org
- Run installer and follow setup wizard
- Install XAMPP to default location (C:\xampp or /opt/lampp)
- Complete installation and launch XAMPP Control Panel
Step 2: Start Apache and MySQL Services
- Open XAMPP Control Panel
- Click "Start" button next to Apache module
- Click "Start" button next to MySQL module
- Wait until both show green "Running" status
- If port conflicts occur, see troubleshooting section below
Step 3: Download WordPress
- Visit wordpress.org/download
- Click "Download WordPress" button
- Save wordpress-6.x.zip file to your computer
- Extract the ZIP file contents
- You'll see a "wordpress" folder with WordPress files
Step 4: Move WordPress to htdocs Folder
- Navigate to your XAMPP installation directory
- Open the "htdocs" folder (C:\xampp\htdocs on Windows)
- Copy the extracted "wordpress" folder into htdocs
- The path should be: C:\xampp\htdocs\wordpress\
- Inside should be wp-admin, wp-content, wp-includes folders
Step 5: Create MySQL Database
- Open browser and go to localhost/phpmyadmin
- Login with username: root, password: (blank)
- Click "New" or "Databases" in left sidebar
- Enter database name:
wordpress_dborwp_local - Select collation:
utf8mb4_general_ci(recommended) - Click "Create" button
- Database is now ready for WordPress installation
Step 6: Run WordPress Installation
- Open browser and navigate to:
localhost/wordpress - You'll see "Welcome to WordPress" installation screen
- Select your language and click "Continue"
- WordPress will ask for database connection details
- Click "Let's go!" to proceed to database configuration
Step 7: Configure Database Connection
- Enter database information from Step 5
- Database Name:
wordpress_db(or your chosen name) - Username:
root(XAMPP default) - Password: (leave blank for XAMPP, or "root" for MAMP)
- Database Host:
localhost(default) - Table Prefix:
wp_(default, or customize) - Click "Submit" to test database connection
- If successful, click "Run the installation"
Step 8: Complete WordPress Setup
- Enter your site information:
- Site Title: Your website name
- Username: Admin username (avoid "admin" for security)
- Password: Strong password (WordPress will generate one)
- Your Email: Your email address
- Search Engine Visibility: Check to discourage search engines
- Click "Install WordPress" button
- Installation completes in a few seconds
- 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:
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
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
Enable WordPress Debug Mode
For local development, enable debugging to see error messages:
Optimize WordPress for Local Development
Increase PHP Limits
Disable Auto-Updates
Disable Cron for Development
Migrate Local WordPress to Live Server
Steps to move your local site to production:
- Export database from phpMyAdmin (Export → SQL format)
- Use Search & Replace tool to change localhost URLs to live domain
- Upload WordPress files via FTP to web hosting
- Create new database on hosting control panel
- Import modified SQL file to live database
- Update wp-config.php with live database credentials
- 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
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
- localhost/phpmyadmin - Database management for WordPress
- localhost/xampp - XAMPP dashboard and tools
- localhost:3306 - MySQL database port
- localhost:80 - Apache web server port
- localhost/admin - Admin panels guide
- Troubleshooting Guide - Fix localhost issues