I'm importing an existing wordpress project into DDEV but getting the following after DDEV start:
Waiting for additional project containers to become ready... All project containers are now ready. Include of /Users/me/Sites/myproject.org/myproject/web/wp-config-ddev.php found in /Users/me/Sites/myproject.org/project-myproject/web/wp-config.php Error: 'wp-config.php' not found. Either create one manually or use
wp config create. Task failed: Exec command 'wp config set DB_NAME db' in container/service 'web': exit status 1 A task failure does not mean that DDEV failed, but your hook configuration has a command that failed. Error: 'wp-config.php' not found. ...
The project has a .env file so I've tried adding the following and restarting:
// wp-config-ddev.php not needed
I also tried adding this and restarting:
// Include for DDEV-managed settings in wp-config-ddev.php.
$ddev_settings = dirname(__FILE__) . '/wp-config-ddev.php';
if (is_readable($ddev_settings) && !defined('DB_USER')) {
require_once($ddev_settings);
}
no luck.
I've also tried updating the following in .env and restarting:
DB_NAME=db
DB_USER=db
DB_PASSWORD=db
DB_ROOT_PASSWORD=db
DB_HOST=db
DB_CHARSET=utf8
How can 'wp-config.php' be not found and have the include within it found?
The result is that the site cannot connect to the database
I think you have a post-start exec hook set up in your config.yaml that does a wp config set DB_NAME db
. That's what you're seeing with the message Task failed: Exec command 'wp config set DB_NAME db' in container/service 'web'
The wp config set
command is failing.
Please remove the hooks from your .ddev/config.yaml or .ddev/config.*.yaml and experiment a bit more. Make sure that your project type in .ddev/config.yaml is wordpress
as well.
Please try a plain vanilla WordPress setup using the quickstarts to get perspective on the simplest approach.