I succesfully setup a local multisite, but when I try to deploy it on my staging environment (DigitalOcean droplet), I run into this error.
non-zero return code
PHP Fatal error: Uncaught
Roots\WPConfig\Exceptions\ConstantAlreadyDefinedException: Aborted trying to
redefine constant 'MULTISITE'. `define('MULTISITE', ...)` has already been
occurred elsewhere. in /srv/www/staging.website.nl/releases/20191119124427/vendor/roots/wp-
config/src/Config.php:106
Stack trace:
#0 /srv/www/staging.website.nl/releases/20191119124427/vendor/roots
/wp-config/src/Config.php(26): Roots\WPConfig\Config::defined('MULTISITE')
#1 /srv/www/staging.website.nl/releases/20191119124427/config/application.php(89):
Roots\WPConfig\Config::define('MULTISITE', true)
#2 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1198) :
eval()'d code(7): require_once('/srv/www/stagin...')
#3 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1198):
eval()
#4 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1159):
WP_CLI\Runner->load_wordpress()
#5 phar:///usr/bin/wp/vendor/wp-cli/wp-
cli/php/WP_CLI/Bootstrap/LaunchRunner.php(23): WP_CLI\Runner->start()
#6 phar:///usr/bi in /srv/www/staging.website.nl/releases/20191119124427/vendor/roots/wp-config/src/Config.php on
line 106
fatal: [142.93.237.205]: FAILED! => {"changed": false, "cmd": ["wp", "core", "is-installed", "--skip-plugins", "--skip-themes", "--require=/srv/www/stagingwebsite.nl/shared/tmp_multisite_constants.php"], "delta": "0:00:00.137466", "end": "2019-11-19 12:44:55.781089", "failed_when_result": true, "rc": 255, "start": "2019-11-19 12:44:55.643623", "stderr_lines": ["PHP Fatal error: Uncaught Roots\\WPConfig\\Exceptions\\ConstantAlreadyDefinedException: Aborted trying to redefine constant 'MULTISITE'. `define('MULTISITE', ...)` has already been occurred elsewhere. in /srv/www/staging.website.nl/releases/20191119124427/vendor/roots/wp-config/src/Config.php:106", "Stack trace:", "#0 /srv/www/staging.website.nl/releases/20191119124427/vendor/roots/wp-config/src/Config.php(26): Roots\\WPConfig\\Config::defined('MULTISITE')", "#1 /srv/www/staging.website.nl/releases/20191119124427/config/application.php(89): Roots\\WPConfig\\Config::define('MULTISITE', true)", "#2 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1198) : eval()'d code(7): require_once('/srv/www/stagin...')", "#3 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1198): eval()", "#4 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1159): WP_CLI\\Runner->load_wordpress()", "#5 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(23): WP_CLI\\Runner->start()", "#6 phar:///usr/bi in /srv/www/staging.website.nl/releases/20191119124427/vendor/roots/wp-config/src/Config.php on line 106"], "stdout": "", "stdout_lines": []}
I tried following the instructions in the documentation: Multisite | Trellis Docs | Roots, but they were not entirely clear to me. This part in particular:
Trellis assumes your WordPress configuration already has multisite set up. If not, ensure the following values are placed somewhere in Bedrock’s
config/application.php
before provisioning your server:
This reads like I shouldn’t have to make any changes to config/application.php
, but if I don’t add those changes, my website won’t work locally. If I do add these changes, it works locally, but won’t work when I try to deploy to my staging environment.
I found two threads with the same issue, but they were not much help.
- https://discourse.roots.io/t/aborted-trying-to-redefine-constant-multisite-define-multisite-has-already-been-occurred-elsewhere/15332
- https://discourse.roots.io/t/aborted-trying-to-redefine-constant-multisite-define-multisite/16127
Would appreciate any insight into solving this, thanks!