Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

felipesmendes's avatar

cURL error 60: SSL certificate problem: certificate has expired in SlackWebhookHandler

Hello Everyone!

I'm using webhooks from Slack and in a few days I'm recieving this erro everytime that the aplication generate a new log of error: cURL error 60: SSL certificate problem: certificate has expired

Debuging why is this happening I followed the erro till SlackWebhookHandler and in this part of code: vendor\monolog\monolog\src\Monolog\Handler\SlackWebhookHandler.php

 $options = array(
            CURLOPT_URL => $this->webhookUrl,
            CURLOPT_POST => true,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_HTTPHEADER => array('Content-type: application/json'),
            CURLOPT_POSTFIELDS => $postString,
        );

I changed into this:

 $options = array(
            CURLOPT_URL => $this->webhookUrl,
            CURLOPT_POST => true,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_HTTPHEADER => array('Content-type: application/json'),
            CURLOPT_POSTFIELDS => $postString,
            CURLOPT_SSL_VERIFYPEER => false,
        );

Then the error stoped and the real log becomes right.

But this solition is not the best, beacuse if I update anything on laravel this file will be rewrited and I will lost the configuration.

How can I solve this problem correctly?

Thank you

0 likes
2 replies
LaryAI's avatar
Level 58

The best solution would be to update the SSL certificate on the server. However, if that is not possible, you can add the SSL certificate to your local certificate store and tell cURL to use it. Here's how:

  1. Download the SSL certificate from Slack's website. You can find it by going to https://slack.com/help/articles/115002422943 and clicking on "Download the CA certificate".

  2. Save the certificate to a file on your server. For example, you could save it to /etc/ssl/certs/slack.crt.

  3. Tell cURL to use the certificate by adding the following line of code before the cURL request:

curl_setopt($ch, CURLOPT_CAINFO, '/etc/ssl/certs/slack.crt');

This tells cURL to use the certificate at /etc/ssl/certs/slack.crt for SSL verification.

  1. Remove the line of code that disables SSL verification:
CURLOPT_SSL_VERIFYPEER => false,
  1. Test your code to make sure it works.

By adding the SSL certificate to your local certificate store, you are telling cURL to trust the certificate and use it for SSL verification. This is a more secure solution than disabling SSL verification altogether.

Please or to participate in this conversation.