1 month, 3 weeks ago

Hi,

Im wondering if anyone can help with this issue. A shared host provides wp cli pre installed. This seems to work perfectly from command line, but not when installed and run from cron.

examples of commands used ( which work in shell )

Help with wp cli and cron
Help with wp cli and cron

cd /home/account/public_html;/usr/local/bin/wp --debug --info > /home/logs/wpcron.log 2>&1

source /home/.bash_profile;cd /home/account/public_html;/usr/local/bin/wp --debug --info > /home/logs/wpcron.log 2>&1

PATH = $PATH:/usr/local/bin;export PATH;cd /home/account/public_html;/wp --debug --info > /home/logs/wpcron.log 2>&1

normal debug and info comes out on command line

Help with wp cli and cron
Help with wp cli and cron

but  when trigged through cron  I get

PHP Notice:  Undefined index: argv in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php on line 905PHP Warning:  array_slice() expects parameter 1 to be array, null given in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php on line 905PHP Warning:  Invalid argument supplied for foreach() in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Configurator.php on line 138PHP Warning:  Use of undefined constant STDOUT - assumed 'STDOUT' (this will throw an Error in a future version of PHP) in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/utils.php on line 1057PHP Notice:  Undefined index: argv in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php on line 1024PHP Warning:  implode(): Invalid arguments passed in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php on line 1024PHP Notice:  Undefined index: argv in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php on line 1706PHP Notice:  Trying to access array offset on value of type null in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php on line 1706PHP Warning:  Use of undefined constant STDOUT - assumed 'STDOUT' (this will throw an Error in a future version of PHP) in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/commands/src/Help_Command.php on line 138PHP Warning:  Use of undefined constant STDERR - assumed 'STDERR' (this will throw an Error in a future version of PHP) in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/commands/src/Help_Command.php on line 139PHP Warning:  proc_open(): Descriptor item must be either an array or a File-Handle in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/utils.php on line 1434PHP Warning:  proc_close() expects parameter 1 to be resource, bool given in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/commands/src/Help_Command.php on line 142Content-type: text/html; charset=UTF-8

which are warnings and notices ( not fatal )

but zero output

Help with wp cli and cron
Help with wp cli and cron

I have googled quite extensively and have not come across anything similar

Any pointers?

Help with wp cli and cron
Help with wp cli and cron