What issue or error are you experiencing?
SSL is working on a local site. It is trusted. The site loads over https.
I have created an API endpoint that outputs json from a db query.
The endpoint works. I can see the json output if I put the URL in my browser.
When I use get_file_contents() with the endpoint, I get this error:
file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:0A000086:SSL routines::certificate verify failed
I have seen many posts about this topic, but none have answers. I have asked Google to no avail. My apologies for opening this particular worm can again.
I deleted the cert files and recreated. No change.
I work with custom API endpoints regularly. I uploaded my work to our staging site and the script works. It definitely has to do with my local environment. I can fake it by just copying the json to a string, but I am stubborn and really don’t want to do that. It seems it should be possible to make this work.
Thanks in advance for any insight!
What steps can be taken to replicate the issue? Feel free to include screenshots, videos, etc
I don’t think it is possible to replicate the issue outside of my environment without duplicating my install. I uploaded my work to a staging site and it works just fine.
System Details
Windows 11
Chrome Version 119.0.6045.124 (Official Build) (64-bit)
Local version 8.1.0+6514
PHP 8.2.10 (I was using 8.1.23, but switched to see if the problem would go away)
nginx
MySQL 8.0.16
Wordpress 6.4.1
-
Local Version:
8.1.0+6514 -
Operating System (OS) and OS version:
Windows 11
Local Logs
Attach your Local Logs here (Help Doc - Retrieving Local’s Log)
[16-Nov-2023 02:51:03 UTC] PHP Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:0A000086:SSL routines::certificate verify failed in C:\Users\galdr\Local Sites\lwa\app\public\wp-content\plugins\lwa-stores\includes\functions-tasks-store-edit.php on line 6
[16-Nov-2023 02:51:03 UTC] PHP Warning: file_get_contents(): Failed to enable crypto in C:\Users\galdr\Local Sites\lwa\app\public\wp-content\plugins\lwa-stores\includes\functions-tasks-store-edit.php on line 6
[16-Nov-2023 02:51:03 UTC] PHP Warning: file_get_contents(https://lwa.local/wp-json/lwa-store-tasks/v1/clients): Failed to open stream: operation failed in C:\Users\galdr\Local Sites\lwa\app\public\wp-content\plugins\lwa-stores\includes\functions-tasks-store-edit.php on line 6
Security Reminder
Local does a pretty good job of scrubbing private info from the logs and the errors it produces, however there’s always the possibility that something private can come through. Because these are public forums, always review the screenshots you are sharing to make sure there isn’t private info like passwords being displayed.