am trying to execute wp cli from crontab
i have done the following
first i create .sh file contain the following:
#!/bin/bash
declare -a sites=('/home2/musite/public_html' )
for site in "${sites[@]}";
do
/usr/local/bin/wp --path=$site --skip-plugins=wp-fastest-cache cron event run - -all
done
i tried to run the sh manually and it's run correct but when am scheduling the file to be run automatically through crontab i got the following error:
PHP Warning: array_slice() expects parameter 1 to be array, null given in phar:///usr/local/bin/wp/php/WP_CLI/Runner.php on line 622 Content-type: text/html; charset=UTF-8
Warning: array_slice() expects parameter 1 to be array, null given in phar:///usr/local/bin/wp/php/WP_CLI/Runner.php on line 622
PHP Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/wp/php/WP_CLI/Configurator.php on line 132
Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/wp/php/WP_CLI/Configurator.php on line 132
PHP Warning: proc_open(): Descriptor item must be either an array or a File-Handle in phar:///usr/local/bin/wp/php/commands/help.php on line 111
Warning: proc_open(): Descriptor item must be either an array or a File-Handle in phar:///usr/local/bin/wp/php/commands/help.php on line 111
PHP Warning: proc_close() expects parameter 1 to be resource, boolean given in phar:///usr/local/bin/wp/php/commands/help.php on line 111
Warning: proc_close() expects parameter 1 to be resource, boolean given in phar:///usr/local/bin/wp/php/commands/help.php on line 111
can you please help me with i mad a lot of research but am still can't figure out why this happening.
thanks