I am trying to run the cronJob as for wpcli. But the output is not as expected.
For example :
when I run the command wp --info on terminal I get the following output.
$ ./wp-cli.phar --info
OS: Linux #1 SMP Tue Jul 23 08:31:06 EDT 2019 x86_64
Shell:
PHP binary: /usr/php
PHP version: 7.3.16
php.ini used: /usr/php/php.ini
WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir: phar://wp-cli.phar/vendor
WP_CLI phar path: /home/user
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.4.0
But if I run the same using CronJob and redirect the output to a log file, it is not the same.
CronJob command used :
./wp-cli.phar --info >> ~/info.log
Output I get :
Content-type: text/html; charset=UTF-8
Content-type: text/html; charset=UTF-8
Content-type: text/html; charset=UTF-8
If I append the another command along with it, its out is received properly.
For example :
./wp-cli.phar --info >> ~/info.log && date >> ~/info.log
Output :
Content-type: text/html; charset=UTF-8
Sat Apr 11 12:45:15 CEST 2020