Roots Discourse

WP-CLi - Fatal error

Hi guys, just trying to export db via wp-cli but for some reason if I try to do it with non-root user it’s not working on my server, also seems like inside vagrant everything is ok. Do I must to use --allow-root or there is some workaround for this.
Here is the error:

Fatal error: Uncaught Dotenv\Exception\InvalidPathException: Unable to read any of the environment file(s) at [/srv/www/]. in /srv/www/

Stack trace:
    #0 /srv/www/ Dotenv\Store\FileStore->read()
    #1 /srv/www/ Dotenv\Dotenv->load()
    #2 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1197) : eval()'d code(7): require_once('/srv/www/')
    #3 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1197): eval()
    #4 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1158): 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/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(74): WP_CLI\Bootstrap\LaunchRunner->p in /srv/www/ on line 57

UPD: fixed by moving folder ownership to the user which execute this command.

1 Like