wp-cli / package-command

Lists, installs, and removes WP-CLI packages.
MIT License
17 stars 20 forks source link

SSL certificate problem: certificate has expired #145

Closed hirasso closed 2 years ago

hirasso commented 2 years ago

Bug Report

Describe the current, buggy behavior

wp package install fails due to expired certificate

Describe how other contributors can replicate this bug

This command:

wp package install wp-cli/find-command

returns this error:

Error: curl error 60 while downloading https://wp-cli.org/package-index/packages.json: SSL certificate problem: certificate has expired

Describe what you would expect as the correct outcome

I would expect that the package wp-cli/find-command would be installed.

Environment

OS: Darwin 21.1.0 Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:01 PDT 2021; root:xnu-8019.41.5~1/RELEASE_ARM64_T6000 arm64
Shell:  /usr/local/bin/fish
PHP binary: /Applications/MAMP/bin/php/php8.0.8/bin/php
PHP version:    8.0.8
php.ini used:   /Applications/MAMP/bin/php/php8.0.8/conf/php.ini
MySQL binary:   
MySQL version:  
SQL modes:  
WP-CLI root dir:    phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:  phar://wp-cli.phar/vendor
WP_CLI phar path:   /Users/rah/Sites
WP-CLI packages dir:    /Users/rah/.wp-cli/packages/
WP-CLI global config:   
WP-CLI project config:  
WP-CLI version: 2.5.0
schlessera commented 2 years ago

@hirasso Can you try this same command with the latest nightly version of WP-CLI? You can update to the latest nightly version via the following command:

wp cli update --nightly
hirasso commented 2 years ago

@schlessera I updated to 2.5.1-alpha-e09df43 and ran wp package install wp-cli/find-command again. The error persists.

danielbachhuber commented 2 years ago

Hey @hirasso,

If it's helpful, here's a report of a similar problem: https://github.com/wp-cli/profile-command/issues/172

Essentially, you likely have an out of date SSL certificate on your machine that you'll need to update.

hirasso commented 2 years ago

Hi @danielbachhuber , thanks for your reply! Do you by any chance know how I can discover which SSL certificate is being used for CURL? I'm on a MAC and can't find anything via Google... probably I don't know the right wording for the search phrase ;)

hirasso commented 2 years ago

I looked up the location of openssl on my system as described here. Then I updated my cert.pem file as described here. After that, the error still persists, even after a restart. That's why I'm asking myself if wp-cli's curl actually uses this certificate at all...

hirasso commented 2 years ago

Ok, found it. After one year. My terminal php was linked to MAMP:

❯ which php
/Applications/MAMP/bin/php/php7.4.21/bin/php

Then I googled for "mamp curl error 60 ssl certificate problem certificate has expired" and found this post on SO, that finally helped me solve it.

In a nutshell: I had to tell my PHP version which cacert.pem it should be using.

danielbachhuber commented 2 years ago

@hirasso Glad you were able to figure it out! 🐛 🔨

hirasso commented 2 years ago

It really made a big difference to get a helping hand like yours today, @danielbachhuber . Just having this feeling that someone actually cared out there helped me finally take the time to solve this. Thanks again!

danielbachhuber commented 2 years ago

Just having this feeling that someone actually cared out there helped me finally take the time to solve this.

❤️

Thanks again!

You're welcome!