0

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!

Diplodoco
  • 71
  • 1
  • 7
  • Any chance you didn't restart your web server after changing php.ini? – Aleksandar Jun 25 '22 at 18:02
  • Make sure the webserver can access the cacert.pem file. Check rights and owner/group. – Markus Zeller Jun 25 '22 at 18:09
  • You could also set curl option `CURLOPT_SSL_VERIFYPEER` to false. I don't know how it's done using Guzzle. This is a workaround. – IT goldman Jun 25 '22 at 18:33
  • Thank you all for your suggestions! 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. – Diplodoco Jun 27 '22 at 11:01

1 Answers1

0

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.

Diplodoco
  • 71
  • 1
  • 7