wp-cli/server-command

Does not use run "require" php scripts defined in wp-cli.yml?

hisham opened this issue · 1 comments

In my wp-cli.yml I have the following which tells wp-cli to run a php script before every command:

require:
    - wp-env.local.php

This file contains lines such as:

$_SERVER['DB_NAME']='wordpress';
$_SERVER['RDS_HOSTNAME']='127.0.0.1';

But these environment variables do not seem to be set when the server is run. The php script does not seem to be loaded. 'wp core install' and other related commands work fine however.

How come the variables are not passed through to the server environment?

wp server launches a secondary process to run the server itself: https://github.com/wp-cli/server-command/blob/master/src/Server_Command.php#L87

If you want to define environment variables, you can create a wp-env.local.ini file and include the ini file when the server is launched.