• trying to run:

    * * * * 1-5 /usr/local/bin/wp –path=/home/myuser/public_html/wordpress core version >> /root/test.log 2>&1

    and I′m getting in test.log:

    Content-type: text/html; charset=UTF-8

    It′s what I′m getting from any bash script with wp-cli commands. Those scripts run fine from command line:

    #!/bin/bash

    WP=/usr/local/bin/wp
    array=($(find /home -maxdepth 6 -type d -name ‘*wp-content*’ -exec dirname {} \;))

    for x in ${array[@]} ;do
    echo “Checking:” $x
    $WP –allow-root –path=$x core version
    done

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @ibertrix,

    Here’s an explanation of the issue. You’ll need to make sure Phar support is enabled for the PHP executable when cron is running.

    Thread Starter ibertrix

    (@ibertrix)

    I do have Cpanel with EasyApache 4 but I don′t have suhosin installed:

    php -v
    ea-php-cli Copyright 2017 cPanel, Inc.
    PHP 7.0.25 (cli) (built: Nov 7 2017 04:14:18) ( NTS )
    Copyright (c) 1997-2017 The PHP Group
    Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.25, Copyright (c) 1999-2017, by Zend Technologies

    Do I still need to set it?

    Thread Starter ibertrix

    (@ibertrix)

    Ok, I have solved it within the script:

    #!/bin/bash
    
    WP="/usr/local/bin/php -d suhosin.executor.include.whitelist=phar /usr/local/bin/wp --allow-root"
    
    array=($(find /home -maxdepth 6 -type d -name '*wp-content*' -exec dirname {} \;))
    
    for x in ${array[@]} ;do
     echo "Chequeando:" $x
     $WP --path=$x core version
    done
    Thread Starter ibertrix

    (@ibertrix)

    Many thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WP-CLI issues running wp-cli commands in cronjobs’ is closed to new replies.