Users cannot use WP-CLI in cron

VM Creativo

Member
Dec 8, 2018
8
9
3
Spain
cPanel Access Level
Root Administrator
Hello, I installed WP-CLI from root, I can use it from a user's terminal without problems, but when I want to use it in CRON, I get the following errors:

Code:
PHP 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 995
PHP 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/WP_CLI/Loggers/Quiet.php on line 43
PHP Warning:  fwrite() expects parameter 1 to be resource, string given in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Loggers/Base.php on line 61
Content-type: text/html; charset=UTF-8
If I set up the same cron with the root account (with crontab -e) it works fine:
Code:
* * * * * /usr/local/bin/wp --allow-root --version
But using CPanel cron jobs it fails
Code:
/usr/local/bin/wp --version
----------------

In WP-Cli documentation they say:

The STDOUT constant is defined by the PHP CLI. If you receive an error notice that STDOUT is missing, it’s likely because you’re not running WP-CLI by PHP CLI. Please review your server configuration accordingly.

----------------

I don't know where to look to solve this problem.