Getting started failure (SSL operation failed with code 1. OpenSSL Error messages: error:1416F086)

4,178 views
Skip to first unread message

jovo.are...@gmail.com

unread,
Apr 28, 2018, 6:41:14 PM4/28/18
to Google's DoubleClick for Publishers API Forum
Hi!

It's been a few months since I last used the API and it was working fine before. Today I'm getting this when I try to use any of my previously working scripts:

PS F:\Web\Apache24\htdocs\dfpapi> php dfp-test.php
PHP Fatal error:  Uncaught RuntimeException: Error creating resource: [message] fopen(): SSL operation failed with code 1. OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate verify fai
Fatal error: Uncaught RuntimeException: Error creating resource: [message] fopen(): SSL operation failed with code 1. OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
[file] F:\Web\Apache24\htdocs\dfpapi\vendor\guzzlehttp\guzzle\src\Handler\StreamHandler.php
[line] 323
[message] fopen(): Failed to enable crypto
[file] F:\Web\Apache24\htdocs\dfpapi\vendor\guzzlehttp\guzzle\src\Handler\StreamHandler.php
[line] 323
[message] fopen(https://www.googleapis.com/oauth2/v4/token): failed to open stream: operation failed
[file] F:\Web\Apache24\htdocs\dfpapi\vendor\guzzlehttp\guzzle\src\Handler\StreamHandler.php
[line] 323 in F:\Web\Apache24\htdocs\dfpapi\vendor\guzzlehttp\guzzle\src\Handler\StreamHandler.php:252
Stack trace:
#0 F:\Web\Apache24\htdocs\dfpapi\vendor\guzzlehttp\guzzle\src\Handler\StreamHandler.php(334): GuzzleHttp\Handler\StreamHandler->createResource(Object(Closure))
#1 F:\Web\Apache24\htdocs\dfpapi\vendor\guzzlehttp\guzzle\src\Handler\StreamHandler. in F:\Web\Apache24\htdocs\dfpapi\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php on line 52

I tried going through https://developers.google.com/doubleclick-publishers/docs/start from scratch and it didn't help. I also tried supplying the absolute path to adsapi_php.ini to fromFile() methods of OAuth2TokenBuilder() and DfpSessionBuilder() with no change in the outcome.

I'm using Windows 10, Apache 2.4, and PHP 7.2.1. I get the same result by running the example in the Chrome browser and Visual Studio Code inbuilt terminal.

I'm having no luck with searching for the errors so I'm hoping someone can point me in the right direction.

Thanks!

jovo.are...@gmail.com

unread,
Apr 29, 2018, 7:29:49 PM4/29/18
to Google's DoubleClick for Publishers API Forum
Got it! It smelt like an issue with something other than the API and it was! I'll leave my findings for posterity.

1. Installed XAMPP to test out on a fresh environment.
2. Scripts worked!
3. Compared the php.ini files to find interesting differences.
4. Uncommented and edited following lines in the original environment php.ini:

curl.cainfo = "C:\curl-ca-bundle.crt"
openssl.cafile = "C:\curl-ca-bundle.crt"
extension=php_openssl.dll

I lifted the curl-ca-bundle.crt from the XAMPP install and placed it somewhere convenient, the above path is to show format.

I have no idea why it all worked before and then stopped. I'm not even sure that's the case anymore. It's a possibility that I haven't actually tried to run any API scripts in my manually set up environment. In which case this might help someone who takes the same route.
Reply all
Reply to author
Forward
0 new messages