How to run WordPress locally with DDEV
How to run WordPress locally with DDEV, step by step: install, start a site, set the PHP version, import a database and uploads, and take snapshots.
The WP Waterfall team · Workflow

To run WordPress locally, install Docker and DDEV, make a folder, and run ddev config --project-type=wordpress, ddev start, and ddev wp core download. DDEV then gives you a working site at an address like https://my-wp-site.ddev.site, with PHP, a database, and a mail catcher, all in containers that you can delete without touching your computer. This guide takes you from nothing to a local copy of a real site.
Key takeaways
- DDEV runs WordPress in Docker containers, so each project has its own PHP version and database.
- Five commands start a new site, and
ddev import-dbplusddev import-filesbring a real site in. - Match the server's PHP and database versions in
.ddev/config.yaml, so what works locally also works online.
What do you need first?
You need two tools. On macOS and Linux, install Docker and then DDEV. On Windows, run both inside WSL2 with Ubuntu. DDEV's own installation guide has the steps for each system. Check the install with:
ddev --version
DDEV needs ports 80 and 443 for its router. If something else uses them, DDEV picks other ports and tells you. The site address then ends in a port number, such as :33001.
How do you start a new WordPress site?
Make a folder, which becomes the project name, and run these commands inside it:
mkdir my-wp-site && cd my-wp-site
ddev config --project-type=wordpress
ddev start
ddev wp core download
ddev wp core install --url='https://my-wp-site.ddev.site' --title='My Site' \
--admin_user=admin --admin_password=admin --admin_email=admin@example.com
ddev launch
ddev config writes .ddev/config.yaml. ddev start builds the containers and prints the site address. ddev wp runs WP-CLI inside the web container, so you need no WordPress tools on your own computer. ddev launch opens the site in your browser. Log in at /wp-admin/ with the user and password you chose, then change them if you ever share the project.
Where are the files, and how do you edit them?
The project folder is the WordPress root. After ddev wp core download you see wp-content, wp-admin, and wp-includes beside the .ddev folder. Open the folder in your editor and your changes show on the next page load, with nothing to upload. DDEV also writes a wp-config.php with the database settings, and a wp-config-ddev.php that it manages, so you do not set the database name and password yourself. The database is db with the user db and the password db.
Keep your own code in Git, not the whole WordPress folder. A common layout tracks only your theme or plugin folders under wp-content, plus .ddev/config.yaml, and ignores uploads and wp-config.php. To step through code with a debugger, turn on Xdebug when you need it with ddev xdebug on, and turn it off with ddev xdebug off, since it slows every request.
How do you match the live server?
A local site is only useful if it behaves like the real one. Set the PHP and database versions to match your host, then restart:
ddev config --php-version=8.3 --database=mariadb:11.8
ddev restart
ddev php --version
Check the versions your host runs and use the same ones. You can try a newer PHP version locally before you change the server, which is a safe way to test an upgrade.
How do you bring a real site in?
You need two things from the real site: a database export and the uploads folder. With WP-CLI on the old server, wp db export site.sql makes the first one, and a zip of wp-content/uploads is the second. Then:
ddev import-db --file=site.sql.gz
ddev import-files --source=uploads.zip
ddev wp search-replace 'https://example.com' 'https://my-wp-site.ddev.site' --skip-columns=guid
ddev import-db accepts a .sql, .sql.gz, or .zip file. The search and replace changes the site address in every table, and it handles serialized data correctly. Add --dry-run first to see the counts before it changes anything. Copy the plugins and themes into wp-content, or keep them in a Git repository and clone it there.
Be careful with production data. A database from a live shop holds customer names and emails. Work with a copy that has those fields removed, and never leave a dump in a folder that goes into Git.
How do you see email and use snapshots?
DDEV catches every email the site sends, so a test order never reaches a real customer. Open the inbox with:
ddev launch -m
Before a risky change, take a database snapshot and restore it if it goes wrong:
ddev snapshot --name before-update
ddev snapshot restore before-update
You can also export the database at any time with ddev export-db --file=backup.sql.gz.
What if something goes wrong?
- A port is busy. DDEV tells you which one and picks another. You can also stop what holds the port, then run
ddev restart. - The site shows the wrong address. Run the search and replace again with the right addresses.
- Strange behavior after changing versions. Run
ddev restart, and if it persists,ddev poweroffstops every DDEV project so the next start is clean. - You want to start over.
ddev deleteremoves the project's database and containers. Your files stay in the folder.
Where does WP Waterfall fit?
If your site runs on WP Waterfall, the DDEV add-on does the import for you. It links a DDEV project to one environment, then pulls the code, the database, and the uploads, and pushes code back to staging. Live is pull only, so you can copy production down but never push to it. The full walk through is in Run WordPress locally with DDEV against a real site, and the reference is Develop locally with DDEV. An AI assistant can also set it up with the set_up_local_development prompt of the WordPress MCP server.
Read next
Related articles
Workflow · November 12, 2026WP-CLI commands every WordPress developer should knowThe WP-CLI commands every WordPress developer should know, with examples you can copy: plugins, database, users, cache, cron, and search and replace.
Workflow · September 23, 2026Run WordPress locally with DDEV against a real siteHow to run WordPress locally with DDEV against a real site: pull code, database, and uploads from WP Waterfall, edit, and push code back to staging.
Workflow · September 18, 2026Immutable live codeWhen a site uses Git, nothing writes PHP on the live environment. Code changes on staging, a deploy copies a release to live, and a rollback undoes it.