简体   繁体   中英

Cloudinary PHP SDK - cURL error 60 uploading image

I am working on a project with Symfony 6, PHP 8 and trying to upload images to Cloudinary using its PHP SDK, cloudinary/cloudinary_php version 2.7.1 and following these docs .

I am creating a Cloudinary instance as

$cloudinary = new Cloudinary([
    'cloud' => [
        'cloud_name' => 'my_name',
        'api_key' => 'my_api_key',
        'api_secret' => 'my_api_secret']
]);

and then uploading my base64 file as

$result = $cloudinary->uploadApi()->upload($base64Image);

Doing this I get the following GuzzleHttp\\Exception\\RequestException :

cURL error 60: SSL certificate problem: self signed certificate in certificate chain (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://api.cloudinary.com/v1_1/oralec/image/upload

What I tried

I ended up in this question (and others of the same nature) where the accepted answer is always to download cacert.pem from https://curl.se/docs/caextract.html and the set your modify your php.ini file with

curl.cainfo = <absolute_path_to> cacert.pem

which in my case is

curl.cainfo = "C:\php\cacert.pem"

But this makes no difference in the exception I get. I tried modifying php.ini, php.ini-development and php.ini-production, just in case.

I also tried installing vendors like https://github.com/composer/ca-bundle and https://github.com/paragonie/certainty , again with no success at all.

Any help is appreciated!

I eventually found that Symfony was using a php located in a different folder than the one I wrote (Instead of C:\php it was C:\xampp\php ).

Changing php.ini in that location fixed the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM