I am setting up a new billing system for a new venture of mine at http://www.cpanelreseller.com and I was having a bear of a time getting php to connect with curl to authorize.net.
After I setup a test php script to see what was happening, since I did not have any log files to give me a clue as to what was going on.
<?php //Filename: curl_test.php $ch = curl_init(); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Uncomment this for Windows. //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_URL, "https://www.geotrust.com/index.html); $result = curl_exec($ch); echo '<pre>';<br /> print_r(curl_getinfo($ch)); echo '</pre>'; echo 'Errors: ' . curl_errno($ch) . ' ' . curl_error($ch) . '<br><br>'; curl_close ($ch); echo $result . 'EOF'; ?>
I kept getting this error:
Errors: 60 error setting certificate verify locations: CAfile: /usr/share/ssl/certs/ca-bundle.crt CApath: none
So now I knew what the problem was, apache was not being allowed access to the ca-bundle.crt file.
To correct the error, I gave some read permissions to the directory with:
[server][root][~]# chmod 755 /usr/share/ssl/certs
This was happening on a CPanel Server, so your mileage may vary on another system, but hopefully, it will get you started down the right path.