Install Redis
- Connect to your Ubuntu WSL2 machine
- Navigate to the project
cd ~/dev/your-website - Go to this link https://github.com/ddev/ddev-redis and follow the installation instructions
ddev add-on get ddev/ddev-redis- Create or edit
.ddev/config.yamland add:
hooks:
post-start:
- exec: |
wp config set WP_REDIS_HOST redis --type=constant
wp config set WP_REDIS_PORT 6379 --type=constant --raw
wp config set WP_REDIS_DATABASE 0 --type=constant --raw
wp config set WP_REDIS_CLIENT phpredis --type=constant
This uses WP-CLI to inject the constants into wp-config.php every time DDEV starts or restarts, so you never have to worry about it being wiped.
Then run:
ddev restart
And verify:
ddev exec wp config get WP_REDIS_HOST
Should return redis.
The constants are we dynamically creating are these:
define('WP_REDIS_HOST', 'redis');
define('WP_REDIS_PORT', 6379);
define('WP_REDIS_DATABASE', 0);
define('WP_REDIS_CLIENT', 'phpredis');
Now you are ready to connect the redis server with your WordPress dev website. Enjoy!
Install phpMyAdmin
You need to install it ddev add-on get ddev/ddev-phpmyadmin && ddev restart and then you can execute ddev phpmyadmin to call phpmyadmin.