PHP common pitfall -> SSL certificate verify failed exception PHP uses curl to execute web requests …

PHP common pitfall -> SSL certificate verify failed exception

PHP uses curl to execute web requests and out of box it comes with no root CAs, so any call with sslverify argument set to true (which is on by default) will fail with exception "error:14090086:SSL  routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed".

The problem is that way tooo many plugin developers and end-users solve it by curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0) which basically means bye bye SSL and welcome man in the middle attack.

Proper solution is to download Root CAs archive (.pem) from http://curl.haxx.se/docs/caextract.html, drop it into PHP installation folder and then edit php.ini by adding curl.cainfo=c:\php_install_location\cacert.pem line.

#2wp

cURL – Extract CA Certs from Mozilla

pingback of Google+ post on January 31, 2013 at 10:43AM

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s