Multisite - database error on vagrant up

On a fresh multisite environment with the latest Trellis / Bedrock, I receive an error when provisioning with Vagrant. The error output at TASK [wordpress-install : Setup Permalink Structure]:

"stderr": "WordPress database error Table 'mysite_dev_development.wp_blogs' doesn't exist for query SELECT * FROM wp_blogs WHERE domain = 'mysite.dev' AND path = '/' made by include('phar:///usr/bin/wp/php/boot-phar.php'), include('phar:///usr/bin/wp/php/wp-cli.php'), WP_CLI\\Runner->start, WP_CLI\\Runner->load_wordpress, require('phar:///usr/bin/wp/php/wp-settings-cli.php'), require('wp-includes/ms-settings.php'), get_site_by_path\nError: Site mysite.dev/ not found.", "stdout": "", "stdout_lines": [], "warnings": []}

wordpress_sites.yml:

mysite.dev:
  site_hosts:
    - mysite.dev
  local_path: ../sites/mysite.nl # path targeting local Bedrock site directory (relative to Ansible root)
  admin_email: myemailadress
  multisite:
    enabled: true
    subdomain: false
  ssl:
    enabled: false
    provider: self-signed
  cache:
    enabled: false
  env:
    domain_current_site: mysite.dev

Added at the bottom of application.php:

/* Multisite */
define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false); // Set to false if using subdirectories
define('DOMAIN_CURRENT_SITE', env('DOMAIN_CURRENT_SITE'));
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

I believe this is the same bug as here: https://github.com/roots/trellis/issues/482

I just opened a PR which I hope will fix this: https://github.com/roots/trellis/pull/543

2 Likes

Thanks for looking into this. I’ve manually changed the command in my finalize-after.yml file as per your PR. However on a fresh vagrant up I still receive the same error.

@richardwilis oh sorry looking at it more closely you have the same error but in a different place. The error I fixed was during deploys, not the wordpress-install role. I’ll add the fix there as well.

Here it is: https://github.com/roots/trellis/pull/546

@swalkinshaw After applying 546 I still get the same error. It seems to fail at creating a database or db table. The error message reads:

WordPress database error Table
'mysite_dev_development.wp_blogs' doesn't exist for
query SELECT * FROM wp_blogs WHERE domain =
'mysite.dev' AND path = '/' made by
include('phar:///usr/bin/wp/php/boot-phar.php'),
include('phar:///usr/bin/wp/php/wp-cli.php'), WP_CLI\Runner->start,
WP_CLI\Runner->load_wordpress, require('phar:///usr/bin/wp/php/wp-settings-
cli.php'), require('wp-includes/ms-settings.php'), get_site_by_path
Error: Site mysite.dev/ not found.
failed: [default] => (item=mysite.dev) => {"changed": true, "cmd": ["wp", "rewrite", "structure", "/%postname%/", "--allow-root"], "delta": "0:00:00.075281", "end": "2016-04-03 13:26:01.985200", "failed": true, "item": "mysite.dev", "rc": 1, "start": "2016-04-03 13:26:01.909919", "stderr": "WordPress database error Table 'mysite_dev_development.wp_blogs' doesn't exist for query SELECT * FROM wp_blogs WHERE domain = 'mysite.dev' AND path = '/' made by include('phar:///usr/bin/wp/php/boot-phar.php'), include('phar:///usr/bin/wp/php/wp-cli.php'), WP_CLI\\Runner->start, WP_CLI\\Runner->load_wordpress, require('phar:///usr/bin/wp/php/wp-settings-cli.php'), require('wp-includes/ms-settings.php'), get_site_by_path\nError: Site mysite.dev/ not found.", "stdout": "", "stdout_lines": [], "warnings": []}

And on the website: Error establishing a database connection

I’m getting the same error @richardwilis is reporting using the latest version of Trellis.

Did anyone manage to resolve this error with a multisite installation using subdirectories? I have been rocking my head over this past 24 hours without any success.

I’ve got this same issue on a new install of Trellis and the fix at this link fixed it.