1

I have a Linux crontab that runs a bash script. In the bash script, it executes a few wp-cli commands. I want to apply a custom php.ini file when wp-cli runs to ensure timeouts are not an issue. Is there a setting/method that allows you to set a custom php.ini to use with wp-cli?

Thanks!

  • Timeouts shouldn't be an issue for CLI commands, your CLI PHP should have a different php.ini to that used for serving webpages, but that's a PHP specific server issue – Tom J Nowell Dec 12 '17 at 2:44
0

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.
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.