Troubleshooting: PHP API for Cloud Files Stops at Authentication

The PHP API for Cloud Files does not catch CURL errors. An exception will be thrown, however it will not contain any useful information to troubleshoot the problem. Here is a likely symptom and a solution.

Symptoms

You may notice messages in the stack trace about being unable to authenticate, but no reason as to why. For example, using the WordPress CDN Tools plugin, the error message might look like the following:

Solution

The problem that I ran into was missing CA certificates. It was resolved by running the following command on my Ubuntu box:

An alternative is to ignore certificates altogether, which from a security standpoint is not very wise. But if you are desperate, add the following to cloudfiles_http.php line 210 (as of the time of this writing, the current version is 1.3.0). There should be a block of curl_setopt() commands. Add the command before the curl_exec().

If that fails and the exception messages are not telling you what the problem is, it could be something different altogether. In this worst case scenario, place the following line just after the curl_exec() but before curl_close().

That should then give you the necessary information to correct the problem.

Good luck and feel free to post a comment if you discover different problems or solutions to the PHP API for Cloud Files.

9 thoughts on “Troubleshooting: PHP API for Cloud Files Stops at Authentication

  1. After checking all the SSL and cURL stuff, it was all right. Downloading the cert and renaming it did the trick for us:

    cd /usr/local/share mkdir curl cd curl wget “http://curl.haxx.se/docs/caextract.html” ln cacert.pem curl-ca-bundle.crt

  2. You can import the CA bundle if you’re running Mac OS X by opening Keychain Access, then clicking on the ‘System’ keychain, then click File > Import Items… and choose the cacert.pem file.

  3. Excellent. I’m glad I found this as when I first installed the API it threw the same error. It looks like it was updated to allow alternate CAs – this is in the documentation: ($auth->ssl_use_cabundle(); # bypass cURL’s old CA bundle)

    But when I put that in, it still didn’t work. Doing an aptitude install did the trick. Thanks!

    1. Hi Andrew

      I am also getting this error and i tried the second option changes cloudfiles_http.php but it still not working. I need help: how to install the ca certificate on my linux server. And also tell me how to remove or uninstall if it causes problem

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.