Join 1M+ other developers and:
- Get help and share knowledge in Q&A
- Subscribe to topics of interest
- Get courses & tools that help you grow as a developer or small business owner
Using Spaces with Laravel - cURL Error 60
I am attempting to connect to a Digital Ocean Space from a Laravel 8 webapp using PHP 8. Whenever I try to upload a file, I get this error:
Aws\S3\Exception\S3Exception Error executing "PutObject" on "//[MY-SPACE-NAME].ams3.digitaloceanspaces.com/[MY-SPACE-NAME].ams3.digitaloceanspaces.com"; AWS HTTP error: cURL error 60: SSL: no alternative certificate subject name matches target host name '[MY-SPACE-NAME].ams3.digitaloceanspaces.com' (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://[MY-SPACE-NAME].ams3.digitaloceanspaces.com/[MY-SPACE-NAME].ams3.digitaloceanspaces.com
Here is my config file:
'spaces' => [ 'driver' => 's3', 'key' => env('SPACES_KEY'), 'secret' => env('SPACES_SECRET'), 'endpoint' => env('SPACES_ENDPOINT'), 'region' => env('SPACES_REGION'), 'bucket' => env('SPACES_BUCKET'), ]
… and my .env file:
SPACES_KEY=**** SPACES_SECRET=**** SPACES_ENDPOINT=ams3.digitaloceanspaces.com SPACES_BUCKET=[MY-SPACE-NAME] SPACES_REGION=ams3
If I add “https://” to the start of the endpoint, it seems to want to prefix the space name before the protocol, ending up with this:
[MY-SPACE-NAME].https://ams3.digitaloceanspaces.com, which obviously throws up another error (cURL error 1).
In the other threads I’ve seen relating to this issue, the suggested solution has been to either uppercase the region (which has no effect in this case) or add ‘https://’ to the endpoint, which doesn’t work either. Prefixing 'https://’ to the space name yields the correct URL but the same error: cURL error 60. Usually this problem occurs on Windows-users’ local dev environments, so I can’t figure why this is happening in my case (both in my local dev environment on macOS and on a server running Ubuntu.
Some assistance would be most appreciated. Thanks.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×