• (The link is a dummy because the problem is not experienced through the browser).

    I have AIOS 5.1.9 installed on a WP 6.2.2 site. I use wp-cli for various tasks. This problem just started with AIOS 5.1.9 (I’m not sure what version it was updated from, but pretty recent). When I do various wp-cli commands, such as “wp plugin list” or “wp transient delete –all” I get this error output:

    $ wp transient delete --all
    AIOS_Helper::request_remote exception - cURL error 77: error setting certificate verify locations:  CAfile: /home/XXX/public_html/XXX.com/wp-includes/Requests/src/../certificates/cacert.pem CApath: /etc/ssl/certs
    Success: 19 transients deleted from the database.
    

    As you can see, the command completes OK, but the error message is bothersome. I’ve done a bit of searching but haven’t found the answer. Any idea what the underlying issue is? My WP install does not have any cacert.pem files in core, only in some plugins. The wp-includes/certificates/ca-bundle.crt file is in place as usual, but AIOS_Helper seems to be looking for something different.

    Thanks for any help,
    Mark

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • I’m facing the exact same issue.

    Plugin Support hjogiupdraftplus

    (@hjogiupdraftplus)

    Hi @swcp @sotiris_k

    Sorry for late reply AIOS helper tries include wp-includes/certificates/ca-bundle.crt only

    https://snipboard.io/DlyhGn.jpg

    Generally such issue is related to server level in php.ini configuration curl.cainfo have correct file path and exists.

    Regards

    Thread Starter Mark Costlow

    (@swcp)

    @hjogiupdraftplus thank you for the pointer, that got me to a fix.

    I downloaded a current cacert.pem from https://curl.se/docs/caextract.html and set curl.cainfo in my php.ini to point to the file. No more error messages from curl.

    I was led astray by curl mentioning a specific path in the WP core that was really not related to the issue.

    Thanks again,
    Mark

    I did the exact same thing and I’m still seeing the error message.

    I have wp-cli setup to run my wp cron jobs every 5 minutes and weirdly whenever there’s nothing in the queue to be run, it shows that message.

    Plugin Support hjogiupdraftplus

    (@hjogiupdraftplus)

    Hi @sotiris_k

    Are you sure you are updating right php.ini and right after setting right path with enough permission to read that file you have server / php service restarted.

    If still issue please provide me the exact error basically it is wp-cli with curl issue.

    Thread Starter Mark Costlow

    (@swcp)

    I’m afraid my announcement of success was premature as well. It turns out the problem is more intermittent than I thought. When I tested after adding the cainfo setting, it didn’t give the error. But then later doing some other things (search-replace mostly) I’m back to getting curl error 77.

    I tried some more variations, like setting cafile or capath, but the results are inconsistent. I still see curl error 77 on many, but not all, wp-cli runs.

    Thread Starter Mark Costlow

    (@swcp)

    Here’s some more info. Well not really new info, just a transcript of a few commands to demonstrate I believe I set cafile in the right php.ini file, but still get the curl error on many, but not all, wp-cli runs.

    $ php --version
    PHP 7.4.30 (cli) (built: Jun 27 2022 08:14:10) ( NTS )
    Copyright (c) The PHP Group
    Zend Engine v3.4.0, Copyright (c) Zend Technologies
        with Zend OPcache v7.4.30, Copyright (c), by Zend Technologies
    
    $ wp --version
    WP-CLI 2.8.1
    
    $ php info.php | grep curl
    /etc/php/7.4/cli/conf.d/20-curl.ini,
    curl
    curl.cainfo => /etc/php/7.4/cli/cacert.pem => /etc/php/7.4/cli/cacert.pem
    
    $ head -5 /etc/php/7.4/cli/cacert.pem
    ##
    ## Bundle of CA Root Certificates
    ##
    ## Certificate data from Mozilla as of: Tue May 30 03:12:04 2023 GMT
    ##
     
    $ wp transient delete --all
    AIOS_Helper::request_remote exception - cURL error 77: error setting certificate verify locations:  CAfile: /home/XXX/public_html/sitename/wp-includes/Requests/s
    rc/../certificates/cacert.pem CApath: /etc/ssl/certs
    Success: 2 transients deleted from the database.
    

    Note, when I set curl.capath or curl.cafile, it doesn’t change the error message which mentions a location in core for CAfile and /etc/ssl/certs for CApath.

    To add to my previous reply as well, it turns out that it can also show the error even when there are pending jobs in the cron queue. So my initial assessment of it happening when the queue is empty, was wrong.

    I can’t pinpoint exactly what causes it to happen, only that it happens solely because of wp-cli.

    And to answer to @hjogiupdraftplus , I’ve added the cacert.pem in both the php.ini for the CLI and the FPM, both for curl.cainfo and openssl.cafile. The permissions shouldn’t be a problem I believe since it has +r for all.

    The error is
    AIOS_Helper::request_remote exception - cURL error 77: error setting certificate file: /var/www/html/REDACTED/wp-includes/Requests/src/../certificates/cacert.pem

    Plugin Support hjogiupdraftplus

    (@hjogiupdraftplus)

    Hi @swcp @sotiris_k

    It seems issue of certificate path. https://github.com/wp-cli/wp-cli/blob/main/php/utils.php#L783 WP CLI utils will initialize Request class there certificate are not properly set. or temp solution please place certificate at “wp-includes/Requests/certificates/cacert.pem”

    $options['verify'] = ! empty( ini_get( 'curl.cainfo' ) ) ? ini_get( 'curl.cainfo' ) : true;
    

    please contact server provider ?

    or temporaty solution please place certificate file at “wp-includes/Requests/certificates/cacert.pem”

    Regards

    I’m not sure what’s wrong with that line of code you quoted, it seems fine to me.

    Anyway, I added the cacert.pem in that path. I’ll let you know if that solves it.

    Plugin Support hjogiupdraftplus

    (@hjogiupdraftplus)

    @sotiris_k

    That line WP CLI Utils class for Requests try assign the curl.cainfo first as this option not passed It try gets default option that is the issue.

    https://github.com/WordPress/wordpress-develop/blob/6.2/src/wp-includes/Requests/src/Requests.php#L177

    protected static $certificate_path = __DIR__ . '/../certificates/cacert.pem';
    

    Regards

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘curl error 77 when using wp-cli’ is closed to new replies.