cURL error 60: SSL certificate in Laravel 5.4

cURL error 60: SSL certificate in Laravel 5.4

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Resolving cURL Error 60 in Laravel 5.4 Without XAMPP

When running a request through your Laravel application, you might encounter cURL error 60: SSL certificate problem: unable to get local issuer certificate. This error indicates that the underlying cURL library cannot verify the SSL certificate of the remote server. While this often stems from self-signed certificates on the target host, it frequently manifests in development environments where the system's default CA bundle is missing or incomplete.

In many tutorials and forums, the suggested solution involves downloading the cacert.pem file and placing it within your XAMPP installation directory to update the php.ini configuration. However, this approach assumes a specific local environment stack that may not be present in your setup. If you are running Laravel using the built-in php artisan serve command or a standalone PHP binary without XAMPP, the path to the CA bundle must be explicitly configured rather than relying on system defaults or application directories.

The core issue lies in how cURL locates the certificate authority store. By default, cURL looks for the CA bundle at specific paths defined by the curl.cainfo directive in php.ini. If this path is missing or points to a non-existent file, cURL will fail to verify SSL certificates, resulting in error 60. Simply dropping the cacert.pem file into your project's root directory or the XAMPP folder without updating the configuration does not resolve the issue because PHP has no knowledge of that file unless explicitly told where to find it.

To fix this in a non-XAMPP environment, you need to ensure that the curl.cainfo directive points to the correct location of your CA bundle. First, download the official Mozilla CA bundle or a similarly trusted certificate authority collection. In Laravel 5.4, which runs on older versions of PHP (typically 5.6, 7.0, or 7.1), you have two primary options for configuring this:

  1. Modify php.ini: Locate your active php.ini file and add the following line, replacing the path with the absolute path to your downloaded cacert.pem:

    curl.cainfo = "C:/path/to/cacert.pem"
    

    Ensure that the path is correct and accessible by the PHP process. After making this change, restart your development server or clear Laravel's config cache if applicable.

  2. Use an Environment Variable: If modifying php.ini is not feasible due to a managed hosting environment or strict deployment constraints, you can set the CURLOPT_CAINFO option programmatically within your code. This allows cURL to use a custom CA bundle on a per-request basis without altering global PHP configuration.

    You can achieve this by creating a Guzzle client (which Laravel uses for HTTP requests) and explicitly setting the certificate path:

    $client = new \GuzzleHttp\Client([
        'curl' => [
            CURLOPT_CAINFO => '/path/to/cacert.pem',
        ],
    ]);
    
    // Now use $client to make your requests
    $response = $client->get('https://example.com');
    

    Alternatively, if you are using the Request facade directly and need to handle SSL exceptions, ensure that your application logic can gracefully handle the error or configure the underlying cURL context appropriately.

It is important to note that relying on system defaults can be risky in development environments where OS certificates might be outdated. Using a fresh, verified CA bundle ensures consistent behavior across different machines. Additionally, while this configuration resolves the immediate error, it is best practice to understand why the remote server's certificate is not being trusted. If you are working with self-signed certificates for local testing, consider using tools like phpunit or custom middleware to bypass SSL verification strictly for development purposes, rather than globally disabling SSL checks in production.

For those managing complex Laravel deployments where configuration files are centralized, updating the cURL CA bundle path ensures that all subsequent API calls respect your chosen certificate authority store, preventing intermittent SSL failures that can obscure debugging efforts.

Our network