WP CLI package installation

If i try to install any WP CLI package from the container SSH terminal i get this SSL error

Error: The "https://wp-cli.org/package-index/packages.json" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed

Anyone knows how to fix it?

OSX High Sierra 10.13.2
Local by Flywheel 2.2.3

@reegodev At what step are you running into this?

Are you using the installation steps from http://wp-cli.org/#installing

Happy to try and re-create and troubleshoot if you can share the installation flow you are going through

Hey Matteo,

I believe this is caused by a known bug in the Preferred and Custom environments that will be resolved soon.

In the meantime, try running the following command in the container.

apt-get update && apt-get install ca-certificates

Once you do that, try installing a WP-CLI package.

1 Like

@clay beat me to this but definitely a better solution. Basically curl didn’t have the ca-certs to validate the secure handshake. That command adds those and should keep them up to date with future apt-get update

The solution I found was to grab the cert from https://curl.haxx.se/ca/cacert.pem From there I then moved them to etc/ssl/certs. From another thread around this on another support forum they suggested adding a line to php.ini, but I don’t think is necessary. I restarted the site after that.

Again, the better solution would be to follow @clay’s path. Hope this solves it for you.

@clay Thank you it worked like a charm!
@t-rave Clay’s method worked perfectly, so for now im sticking to it as it seems the simplest approach. Thank you anyway

1 Like