Fatal error : Uncaught InvalidArgumentException: SSL CA bundle not found: C:\xampp\cacert.pem in /home/vol10_1/epizy.com/epiz_25136160/printmash.co.uk/htdocs/ShiftImport/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:331
Other Information
Im trying to integrate with the Google Calander API and have go this working on my local machine, but now i’ve tried to make this live on my free hosting, it gives me the above error. Is this a limitation of free hosting or have I missed something? I tried using the LetsEncrpt SSL cert and the CloudFare one but get the same error.
I’ve created a simple web app that will import events into the logged in Google user’s calender. It uses the Google library that I got from composer (Im pretty new to this so please excuse my lack of knowledge).
This all works fine on my local machine, but now that I’ve published it to the free hosting, I get this error when creating a Google_Client. I get as far as signing in with my Google account with OAuth, but then the redirect back to my page (which then builds the Google_Client object) throws this error (I had to turn on the error messages in PHP to see it).
So I’m wondering, before I waste anymore time trawling the internet for an answer, if this is a limitation of the free tier or whether I’ve just got to may an amendment to the code in my composer created vendor folder wherever it’s referencing that wrong file path?
I believe that is incorrect because the path specified was C:\xampp\cacert.pem and here’s why:
That is a Windows-specific path and these servers do not run Windows, they run Linux.
That path references XAMPP, and these servers certainly do not use XAMPP.
Here’s my solution: Check through your code (especially config files) for that path and replace it with either a relative path (if supported) which is preferred or change the path to an absolute path referencing the webserver here.
Our server has a proper CA bundle installed, but it doesn’t matter, because your code is configured to load a custom CA bundle from XAMPP.
You shouldn’t have to make any changes to the Google API client for this, the configuration you’re using here seems highly specific to your XAMPP installation, so that should not be hard-coded in Google software.
In any case, you should be able to search your code for C:\xampp\cacert.pem and find where this is configured. And I think you can just remove that option and have the software fall back to the server configured CA chain, which we have already setup and maintain.
Im not sure why I didnt do a search for that string, probably something to do with me being stubborn that I havent entered it anywhere.
Anyway, after searching for that string, I found it in the vendor folder, specifically vendor/guzzlehttp/guzzle/src/Client.php. So its not my code and I fee like I didnt change that unless it was amended on installation or something. Who knows.
After a small bit of testing, I found that if you set “verify” to true instead of the custom certificate path, it allows the code to work fine. Judging by the below code, it looks like it will still verify the certificate but will use the default path?
Are you use that this code is completely unmodified. Because in the official sources, the verify parameter is set to true, not a specific path.
And just setting it to true is what I can recommend as well. The server’s PHP installation can be configured to use a certain default CA bundle, which can then be configured according to where the bundle is located on the server. Our servers have this setup correctly as well, so you don’t need to tell PHP yourself which CA bundle should be used.
It could very well be that I amended that code myself, I honestly can’t remember. Either way, thank you both for helping me get to that conclusion and I can confirm that it’s all working.