I wanted to update WordPress core version and all plugins every week, so for this I install WP-CLI on my WordPress installed server.

So, for doing this I wrote wp-cli command in Linux shell script as follows,

#! /bin/bash
cd /path to the WordPress installation
/path to the wp --path=/path to the WordPress installation core update

Also, created crontab entry as follows,

30 7 * * * /path to the shell script file > /path to the txt file (which store the output) 2>&1

However, When crontab execute the shell script then I get output as follows,

Warning: fwrite() expects parameter 1 to be resource, string given in phar:///usr/local/bin/wp/php/WP_CLI/Loggers/Base.php on line 61

My PHP Version is,

PHP 5.6.30 (cli) (built: Apr 28 2017 13:36:21) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v5.1.1, Copyright (c) 2002-2016, by ionCube Ltd. with Zend Guard Loader v3.3, Copyright (c) 1998-2014, by Zend Technologies

wp info is,

PHP binary: /usr/local/bin/php PHP version: 5.6.30 php.ini used: /usr/local/lib/php.ini WP-CLI root dir:
phar://wp-cli.phar WP-CLI vendor dir: phar://wp-cli.phar/vendor WP_CLI phar path: /home/staginglatinmark WP-CLI packages dir: WP-CLI global config: WP-CLI project config: WP-CLI version: 1.4.1

Note:- 1) When I execute the shell script manually then it works properly.

2) I am using Linux Red-hat O.S.

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.