• Hi, I am trying to use the wp-cli with a modified wp-config.php. I’ve got a dev environment set up with docker so it does not look like standard wp per se.

    The wp-config.php has:

    require_once('vendor/autoload.php');                                                                                                                                                                                                                      
    require_once('config/application.php');
    require_once(ABSPATH . 'wp-settings.php');

    The first is the php composer autoload
    The second is my custom wp-config setup which uses vlucas/phpdotenv to grab my .env settings.

    This all works great when running wordpress itself, but fails when trying to use wp-cli. It doesn’t like the modified wp-config.php and gets tripped up on the autoload.php. My error message indicates that the autoload.php isn’t being made available.

    PHP Fatal error:  Uncaught Error: Class 'Dotenv\Dotenv' not found in /home/danny/s1t2/s1t2in-master-template-wordpress/config/application.php:7
    Stack trace:
    #0 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1169) : eval()'d code(7): require_once()
    #1 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1169): eval()
    #2 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1130): 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(27): 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}
    

    Any help greatly appreciated!

The topic ‘wp-cli with modified wp-config.php’ is closed to new replies.