Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building phar: curl: error setting certificate verify locations #80

Closed
diimpp opened this issue Mar 20, 2015 · 3 comments
Closed

Building phar: curl: error setting certificate verify locations #80

diimpp opened this issue Mar 20, 2015 · 3 comments

Comments

@diimpp
Copy link

diimpp commented Mar 20, 2015

Hi,
I'm building phar with usage of ads sdk and unfortunately I've this error.

  [FacebookAds\Exception\Exception]                                                                                                                                                   
  error setting certificate verify locations:                                                                                                                                         
    CAfile: phar:///home/username/workdir/build/acme.phar/vendor/facebook/php-ads-sdk/src/FacebookAds/Http/Adapter/../../../../fb_ca_chain_bundle.crt  
    CApath: /etc/ssl/certs                                                                                                                                                              

I think it's totally the same error as this one FriendsOfPHP/Goutte#88

Regards.

@pruno
Copy link
Contributor

pruno commented Mar 21, 2015

Hi @diimpp,

This is a known issue of php-curl: https://bugs.php.net/bug.php?id=69035
As discussed in #47, certificates and SDK release cycles are completely different. We do provide the crt in the repo as a commodity (the default loading path doesn't really fit all situations).
My advice is to package the SDK without the certificate and install the certificate aside on your server(s).
Than, after loading the phar:

use FacebookAds\Api;

Api::init('<APP_ID>', '<APP_SECRET>', '<ACCESS_TOKEN>')
  ->getHttpClient()->setCaBundlePath('<PATH_TO_CERT>');

@pruno pruno closed this as completed Mar 21, 2015
@diimpp
Copy link
Author

diimpp commented Mar 21, 2015

Thank you, @pruno.
I'll follow your advice.

@andreladocruz
Copy link
Contributor

@pruno,

I'm getting the same error here and my code is like this:

private function initApi($accessToken)
    {
        Api::init(
            config('dmg.facebook.app_id'),
            config('dmg.facebook.app_secret'),
            $accessToken)
        ->getHttpClient()
        ->setCaBundlePath(base_path('vendor/facebook/php-business-sdk/fb_ca_chain_bundle.crt'));
    }

It worked for 2 days and now stoped again. Acctually it's an intermitent error.

What do you recommend me to do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants