SSL operation failed with code 1. OpenSSL Error


Jul 07, 2016    Janaki Mahapatra, Zend

file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Try to run the following command in your terminal $ php -r "print_r(openssl_get_cert_locations());" The out put will be something like below
Array
(
    [default_cert_file] => /usr/local/openssl-0.9.8zb/ssl/cert.pem
    [default_cert_file_env] => SSL_CERT_FILE
    [default_cert_dir] => /usr/local/openssl-0.9.8zb/ssl/certs
    [default_cert_dir_env] => SSL_CERT_DIR
    [default_private_dir] => /usr/local/openssl-0.9.8zb/ssl/private
    [default_default_cert_area] => /usr/local/openssl-0.9.8zb/ssl
    [ini_cafile] => 
    [ini_capath] => 
)
You can see, there is no setting for ini_cafile and ini_capath. To fix this issue install OpenSSL and update the path in php.ini like
openssl.cafile=/usr/local/etc/openssl/cert.pem