PayPal IPN not validating SSL Certificate

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Sat Dec 22, 2012 1:52 pm

PayPal IPN not validating SSL Certificate

Postby wdboyle » Sat Dec 22, 2012 2:27 pm


I am setting up a PayPal IPN script. I used the sample code from PayPal. Here is a portion:

Code: Select all

$ch = curl_init('');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close'));

// In wamp like environments that do not come bundled with root authority certificates,
// please download 'cacert.pem' from "" and set the directory path
// of the certificate as shown below.
// curl_setopt($ch, CURLOPT_CAINFO,  dirname('cecert.pem') . 'cacert.pem');
if( !($res = curl_exec($ch)) ) {
    error_log("Got " . curl_error($ch) . " when processing IPN data",3,"IPNError.txt");

When I run it as is I get the following error:

when processing IPN dataGot SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed when processing IPN data

When I run it by trying to specify the cacert.pem file with the line:
curl_setopt($ch, CURLOPT_CAINFO, dirname('cecert.pem') . 'cacert.pem');
I get the following error:

Got error setting certificate verify locations:
CAfile: .cacert.pem
CApath: none

Can you shed some light on these errors? I do have and SSL certificate setup on server and I am useing a Windows server running II6.

Maybe easiest to address the second error first. If I can get the location correct it might fix the first error.


Return to “PHP coding => General”

Who is online

Users browsing this forum: Google [Bot] and 2 guests