Specify custom php.ini to use with WP-CLI

If executing PHP scripts directly on command line, you can try the -d option.

Another way is to make use of the WP_CLI constant:

if ( defined('WP_CLI') && WP_CLI ) {
    // Load custom PHP configurations here.
}