Since 3 days I can\'t connect to the paypal sandbox. I found out that they maybe dissabled the support for SSLv3. So i tried to change the SSL Version in my curl Request by
Had same issue.
response:
bool(false)
and no error logs!
So I've made small script:
and here what I've got in logs:
[12-Feb-2016 15:56:19] PHP Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure in /xxx/yyy.php on line 3
[12-Feb-2016 15:56:19] PHP Warning: file_get_contents(): Failed to enable crypto in /xxx/yyy.php on line 3
[12-Feb-2016 15:56:19] PHP Warning: file_get_contents(https://api-3t.sandbox.paypal.com/nvp): failed to open stream: operation failed in /xxx/yyy.php on line 3
My solution was:
SSL Version OpenSSL/1.0.1e – Good
SSL Version NSS/3.13.6.0 – Bad
I am running on CentOS. Here what I did to update:
Update OpenSSL:
openssl version
if below 1.0 run: yum update openssl make sure it is actually updated
Keep a list of all PHP modules installed via:
yum list installed | grep php
save output!
yum install php-curl
restart apache or fpm and if you are lucky you'll get things working
However if your package repositories outdated or you have curl library installed with NSS SSL bindings you can download and compile curl library manually. I've used phpize tool bundled with the php-devel package. So my problem I've had:
cURL Information 7.19.7
SSL Version NSS/3.13.6.0
and here is how I've changed it to:
cURL Information 7.22.0
SSL Version OpenSSL/1.0.1e
Update OpenSSL:
openssl version
if below 1.0 run: yum update openssl make sure it is actually updated
Keep a list of all PHP modules installed via:
yum list installed | grep php
save output!
#!/bin/bash
PHP_VERSION=$(rpm -qa --queryformat '%{version}' php)
CURL_VERSION=7.22.0
#echo $CURL_VERSION
#exit
#wget --no-check-certificate http://mirror.cogentco.com/pub/php/php-${PHP_VERSION}.tar.gz -O /tmp/php-${PHP_VERSION}.tar.gz
wget --no-check-certificate http://museum.php.net/php5/php-${PHP_VERSION}.tar.gz -O /tmp/php-${PHP_VERSION}.tar.gz
wget --no-check-certificate http://curl.haxx.se/download/curl-${CURL_VERSION}.tar.gz -O /tmp/curl-${CURL_VERSION}.tar.gz
cd /tmp; tar xzf php-${PHP_VERSION}.tar.gz
cd /tmp; tar xzf curl-${CURL_VERSION}.tar.gz
cd curl-${CURL_VERSION}
./configure
make
make install
cd /tmp; rm -rf curl-${CURL_VERSION}*
sleep 2
cd /tmp/php-${PHP_VERSION}/ext/curl/
phpize
./configure
make
make install
cd /tmp; rm -rf php-${PHP_VERSION}*