Sometimes, the internet throws a wrench into the most basic tasks. Like uploading a company logo to your server. Simple, right? Until it isn’t. One day, our logo uploads started failing during CDN syncs. The culprit? A sneaky little error called cURL error 60.

TL;DR

Logo uploads failed because of a cURL error 60 during sync with the CDN. Turns out, our system was choking on an outdated or missing Certificate Authority (CA) bundle. We updated the bundle and added a smart retry method. Now, logo uploads work like buttered toast—smooth and tasty.

What Is cURL Error 60 Anyway?

Let’s keep this chill. When someone uploads a logo, our system sends it to a Content Delivery Network (CDN). The CDN spreads the logo across global servers for fast delivery.

But during this upload, our backend uses cURL, a command-line tool to transfer data. If cURL doesn’t trust the secure connection, it throws this:

cURL error 60: SSL certificate problem: unable to get local issuer certificate

Translated into human-speak: “I don’t trust this server. Something’s off with its security certificate.”

The Certificate Authority (CA) Bundle Problem

Every secure website uses an SSL certificate. cURL relies on a known list of Certificate Authorities (CAs) to verify that these certificates are safe and real.

If that CA list—the CA bundle—is outdated or missing, cURL doesn’t know who to trust. It’ll just raise its hands and throw error 60.

We checked our logs. Yep, every time it failed, it was throwing error 60 right at the curl_exec line. No upload. No CDN sync. Just sad tracebacks.

Finding the Root Cause

  • First, we confirmed the uploads still worked from local machines. No issue there.
  • Then we checked the production servers. Bingo. All errors pointed to cURL and certificate validation failures.
  • We inspected the php.ini config and found a missing line for curl.cainfo.

The CA bundle file was either not set or pointing to an outdated file. Ouch.

Fixing the CA Bundle

The easiest fix? Download the latest CA bundle from the cURL website and make sure PHP and cURL use it.

Here’s what worked for us:

  1. Download the latest cacert.pem from curl.se.
  2. Move it to a known directory, like /etc/ssl/certs/cacert.pem.
  3. Update php.ini:
[curl]
curl.cainfo="/etc/ssl/certs/cacert.pem"

[openssl]
openssl.cafile="/etc/ssl/certs/cacert.pem"

After a quick web server restart, voilà! The error was gone.

But Wait — Why Retry Uploads?

Fixing the CA bundle solved the trust issue. But networks aren’t perfect. What if the CDN is moody for a second? Or a data hiccup causes the upload to fail?

We wanted to make the system more resilient. If you’ve ever hit “refresh” and it just works, you know why.

The Logic Behind Retry

If the sync fails, try again. Simple, right?

But not too fast. And not forever.

Our Retry Strategy

  • Maximum retries: 3 attempts
  • Interval between retries: Exponential backoff (e.g., 1s, 2s, 4s)
  • Only retry on certain errors like timeouts or cURL error 60
function retryUpload($file, $attempt = 1) {
    $maxTries = 3;
    $delay = pow(2, $attempt - 1); // 1s, 2s, 4s

    $result = tryCurlUpload($file);

    if ($result === true) return true;

    if (shouldRetry($result) && $attempt < $maxTries) {
        sleep($delay);
        return retryUpload($file, $attempt + 1);
    } else {
        logFailure($file, $result);
        return false;
    }
}

With that in place, spikes in network errors stopped crippling our CDN syncs.

Nice Bonus: Better Monitoring

While we were in the trenches, we added smart logging. Now, every failed upload tells us:

  • Which server was involved
  • What exact cURL error occurred
  • If it succeeded on a retry and on which attempt

This helped us catch edge cases where, for example, files with special characters in their names disappeared into the void during upload. Mystery solved.

Lessons We Learned

  • SSL errors aren’t always what they seem. Sometimes it’s just a missing config line.
  • Always keep your CA bundle fresh. Like bread. Stale ones don’t work.
  • Retry, but do it smart. Not all errors deserve another shot, but the right ones do.
  • Logs are your best friend. Especially when things go weird o’clock late at night.

Now the Uploads Sing 🎵

Today, when a user uploads their shiny new logo, the process is seamless. Behind the curtain, we’ve got a trusted CA bundle and a loyal retry guard ready to bounce back if anything glitches.

Result? Faster support tickets, happy marketing teams, and better sleep for developers.

Final Thought

In tech, small config slips can cause big headaches. But once you understand the root cause (like cURL error 60), the fix is often simple and satisfying.

So next time uploads go haywire, take a deep breath. It might just be a missing cert and an opportunity to improve your system’s guts.

You cannot copy content of this page