Title: curl error 77 when using wp-cli
Last modified: June 14, 2023

---

# curl error 77 when using wp-cli

 *  Resolved [Mark Costlow](https://wordpress.org/support/users/swcp/)
 * (@swcp)
 * [2 years, 12 months ago](https://wordpress.org/support/topic/curl-error-77-when-using-wp-cli/)
 * (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-block-code
       $ 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](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcurl-error-77-when-using-wp-cli%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 11 replies - 1 through 11 (of 11 total)

 *  [Sotiris Katsaniotis](https://wordpress.org/support/users/sotiris_k/)
 * (@sotiris_k)
 * [2 years, 12 months ago](https://wordpress.org/support/topic/curl-error-77-when-using-wp-cli/#post-16817569)
 * I’m facing the exact same issue.
 *  Plugin Support [hjogiupdraftplus](https://wordpress.org/support/users/hjogiupdraftplus/)
 * (@hjogiupdraftplus)
 * [2 years, 12 months ago](https://wordpress.org/support/topic/curl-error-77-when-using-wp-cli/#post-16819352)
 * Hi [@swcp](https://wordpress.org/support/users/swcp/) [@sotiris_k](https://wordpress.org/support/users/sotiris_k/)
 * Sorry for late reply AIOS helper tries include wp-includes/certificates/ca-bundle.
   crt only
 * [https://snipboard.io/DlyhGn.jpg](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](https://wordpress.org/support/users/swcp/)
 * (@swcp)
 * [2 years, 12 months ago](https://wordpress.org/support/topic/curl-error-77-when-using-wp-cli/#post-16819530)
 * [@hjogiupdraftplus](https://wordpress.org/support/users/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](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
 *  [Sotiris Katsaniotis](https://wordpress.org/support/users/sotiris_k/)
 * (@sotiris_k)
 * [2 years, 12 months ago](https://wordpress.org/support/topic/curl-error-77-when-using-wp-cli/#post-16819717)
 * 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](https://wordpress.org/support/users/hjogiupdraftplus/)
 * (@hjogiupdraftplus)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/curl-error-77-when-using-wp-cli/#post-16820520)
 * Hi [@sotiris_k](https://wordpress.org/support/users/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](https://wordpress.org/support/users/swcp/)
 * (@swcp)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/curl-error-77-when-using-wp-cli/#post-16820527)
 * 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](https://wordpress.org/support/users/swcp/)
 * (@swcp)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/curl-error-77-when-using-wp-cli/#post-16820572)
 * 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.
 *     ```wp-block-code
       $ 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.
 *  [Sotiris Katsaniotis](https://wordpress.org/support/users/sotiris_k/)
 * (@sotiris_k)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/curl-error-77-when-using-wp-cli/#post-16820645)
 * 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](https://wordpress.org/support/users/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`
    -  This reply was modified 2 years, 11 months ago by [Sotiris Katsaniotis](https://wordpress.org/support/users/sotiris_k/).
 *  Plugin Support [hjogiupdraftplus](https://wordpress.org/support/users/hjogiupdraftplus/)
 * (@hjogiupdraftplus)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/curl-error-77-when-using-wp-cli/#post-16820945)
 * Hi [@swcp](https://wordpress.org/support/users/swcp/) [@sotiris_k](https://wordpress.org/support/users/sotiris_k/)
 * It seems issue of certificate path. [https://github.com/wp-cli/wp-cli/blob/main/php/utils.php#L783](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”
 *     ```wp-block-code
       $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
 *  [Sotiris Katsaniotis](https://wordpress.org/support/users/sotiris_k/)
 * (@sotiris_k)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/curl-error-77-when-using-wp-cli/#post-16820982)
 * 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](https://wordpress.org/support/users/hjogiupdraftplus/)
 * (@hjogiupdraftplus)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/curl-error-77-when-using-wp-cli/#post-16821207)
 * [@sotiris_k](https://wordpress.org/support/users/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](https://github.com/WordPress/wordpress-develop/blob/6.2/src/wp-includes/Requests/src/Requests.php#L177)
 *     ```wp-block-code
       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.

 * ![](https://ps.w.org/all-in-one-wp-security-and-firewall/assets/icon-256x256.
   png?rev=2798307)
 * [All-In-One Security (AIOS) – Security and Firewall](https://wordpress.org/plugins/all-in-one-wp-security-and-firewall/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/all-in-one-wp-security-and-firewall/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/all-in-one-wp-security-and-firewall/)
 * [Active Topics](https://wordpress.org/support/plugin/all-in-one-wp-security-and-firewall/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/all-in-one-wp-security-and-firewall/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/all-in-one-wp-security-and-firewall/reviews/)

 * 11 replies
 * 3 participants
 * Last reply from: [hjogiupdraftplus](https://wordpress.org/support/users/hjogiupdraftplus/)
 * Last activity: [2 years, 11 months ago](https://wordpress.org/support/topic/curl-error-77-when-using-wp-cli/#post-16821207)
 * Status: resolved