I’ve updated my pinned solution to reflect the new Composer version.
Not sure if this is related to this but I now receive the following error if I want to use WP-CLI directly in the terminal as well as connected via “vagrant ssh”:
PHP Fatal error: Uncaught Error: Class 'Dotenv\Dotenv' not found in /srv/www/xyz/current/config/application.php:17
Stack trace:
#0 phar:///usr/bin/wp/php/WP_CLI/Runner.php(1070) : eval()'d code(7): require_once()
#1 phar:///usr/bin/wp/php/WP_CLI/Runner.php(1070): eval()
#2 phar:///usr/bin/wp/php/WP_CLI/Runner.php(1032): WP_CLI\Runner->load_wordpress()
#3 phar:///usr/bin/wp/php/WP_CLI/Bootstrap/LaunchRunner.php(23): WP_CLI\Runner->start()
#4 phar:///usr/bin/wp/php/bootstrap.php(75): WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapState))
#5 phar:///usr/bin/wp/php/wp-cli.php(23): WP_CLI\bootstrap()
#6 phar:///usr/bin/wp/php/boot-phar.php(8): include('phar:///usr/bin...')
#7 /usr/bin/wp(4): include('phar:///usr/bin...')
#8 {main}
thrown in /srv/www/xyz/current/config/application.php on line 17
I already switched back to composer_keep_updated: true
and run ANSIBLE_TAGS=composer vagrant provision
. But with composer 1.5.6 and 1.6.2 I get the same result.
Thank you again and best regards,
Philipp
I’ve spooled up a fresh install and I’m getting the following error:
non-zero return code
PHP Fatal error: Uncaught Error: Call to undefined method
Dotenv\Dotenv::create() in /srv/www/site.com/releases/20190227223826/config/application.php:27
Since I’m replying to a year old thread, not sure if this is still relevant but I’ve performed the following without any luck:
rm -rf vendor/
sudo rm /usr/local/bin/composer
wget https://github.com/composer/composer/releases/download/1.5.6/composer.phar
chmod +x composer.phar
sudo mv composer.phar /usr/local/bin/composer
composer install
I’m able to provision the server locally and on a DO droplet but when I attempt a deploy, I get the error above.
Prior to attempting my first deploy, I first installed all my composer dependencies and was given an error when composer attempts to install: philippbaschke/acf-pro-installer
The error states that it requires phpdotenv 2.2 so I changed the version from 3.0.0 to 2.2 and ran composer update which then throws the error from above.
I reverted back to the default composer file supplied with Bedrock and I’m still getting the same error.
We’ve updated our guide for ACF to recommend a different installer repository as a solution to this problem.
Thank you for that!
Even without, after reverting back to the default bedrock composer file, I still receive the error.
You need to use a different syntax depending on which version of phpdotenv you’re using. See:
Still having troubles and receiving the same error. Here are what the following files now look like:
Composer:
/config/application.php:
Here’s the full error output:
non-zero return code
PHP Fatal error: Uncaught Error: Call to undefined method
Dotenv\Dotenv::create() in
/srv/www/site.com/releases/20190228183004/config/application.php:27
Stack trace:
#0 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1150) :
eval()'d code(7): require_once()
#1 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1150):
eval()
#2 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1111):
WP_CLI\Runner->load_wordpress()
#3 phar:///usr/bin/wp/vendor/wp-cli/wp-
cli/php/WP_CLI/Bootstrap/LaunchRunner.php(23): WP_CLI\Runner->start()
#4 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(74): WP_CLI\Boot
strap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapState))
#5 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(23):
WP_CLI\bootstrap()
#6 phar:///usr/bin/wp/php/boot-phar.php(11): include('phar:///usr/bin...')
#7 /usr/bin/wp(4): include('phar:///usr/bin...')
#8 {main}
thrown in
/srv/www/site.com/releases/20190228183004/config/application.php on line
27
fatal: [staging.site.com]: FAILED! => {
"changed": false,
"cmd": [
"wp",
"core",
"is-installed",
"--skip-plugins",
"--skip-themes",
"--require=/srv/www/site.com/shared/tmp_multisite_constants.php"
],
"delta": "0:00:00.119577",
"end": "2019-02-28 18:30:46.799589",
"failed": true,
"failed_when_result": true,
"invocation": {
"module_args": {
"_raw_params": "wp core is-installed --skip-plugins --skip-themes --require=/srv/www/site.com/shared/tmp_multisite_constants.php",
"_uses_shell": false,
"chdir": "/srv/www/site.com/releases/20190228183004",
"creates": null,
"executable": null,
"removes": null,
"stdin": null,
"warn": true
}
},
"rc": 255,
"start": "2019-02-28 18:30:46.680012",
"stderr_lines": [
"PHP Fatal error: Uncaught Error: Call to undefined method Dotenv\\Dotenv::create() in /srv/www/site.com/releases/20190228183004/config/application.php:27",
"Stack trace:",
"#0 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1150) : eval()'d code(7): require_once()",
"#1 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1150): eval()",
"#2 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1111): WP_CLI\\Runner->load_wordpress()",
"#3 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(23): WP_CLI\\Runner->start()",
"#4 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(74): WP_CLI\\Bootstrap\\LaunchRunner->process(Object(WP_CLI\\Bootstrap\\BootstrapState))",
"#5 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(23): WP_CLI\\bootstrap()",
"#6 phar:///usr/bin/wp/php/boot-phar.php(11): include('phar:///usr/bin...')",
"#7 /usr/bin/wp(4): include('phar:///usr/bin...')",
"#8 {main}",
" thrown in /srv/www/site.com/releases/20190228183004/config/application.php on line 27"
],
"stdout": "",
"stdout_lines": []
}
@swalkinshaw Am I suppose to run this command from my trellis local directory?
I tried this command from my trellis local directory, but I still have the same error, for this reason, I am wondering if I have to run this from another directory.
I had this Class ‘Dotenv\Dotenv’ not found error, after I run from my Trellis local directory:
vagrant ssh
cd /srv/www/sitename.com/current
composer update
any suggestion? what else I can try?
Just took over a year-old project with just Bedrock/Sage (no Trellis) and get the same error when trying to create a local DB using wp cli:
$ wp db create
PHP Fatal error: Uncaught Error: Class 'Dotenv\Environment\DotenvFactory' not found in /Users/me/.wp-cli/packages/vendor/illuminate/support/helpers.php:646
Stack trace:
#0 /Users/wiwacloud/Documents/Dev/myproject/config/application.php(37): env('WP_ENV')
...
$ php -v
PHP 7.3.10 (cli) (built: Sep 30 2019 19:59:06) ( NTS )
Any ideas what could be wrong?
phpdotenv is vlucas/phpdotenv (v2.5.1).
Tried changing to latest 3+ something and then other things break since bedrock files are using the old at this point.
composer json stuff: (seems weird that php is only 5.6 etc. tbh):
"require": {
"php": ">=5.6",
"composer/installers": "^1.4",
"vlucas/phpdotenv": "^2.0.1",
"johnpbloch/wordpress": "4.9.8",
"oscarotero/env": "^1.1.0",
"roots/wp-password-bcrypt": "1.0.0",
"roots/wp-config": "1.0.0",
.. + some plugins from wpackagist..
}
Any tips appreciated!