How to fix the error in PHP - Fatal error: Uncaught Runtimeexception: Curl error (code 77)

Asked

Viewed 270 times

1

I’m trying to parameterize Monolog in PHP and I’m getting an error. I’m trying to interpret this mistake, but I can’t understand what it is occurring, someone knows what could be ?.

The mistake

Fatal error: Uncaught Runtimeexception: Curl error (code 60): SSL Certificate problem: Unable to get local Issuer Certificate in C: wamp www alerts_monolog vendor monolog monolog src Monolog Handler Curl Util.php:53 Stack trace: #0

In other questions said to put the file "cacert.pem" in the folder of Wamp botei in C: wamp bin php php7.3.1 extra ssl, the error passed to this below.

Fatal error: Uncaught Runtimeexception: Curl error (code 77): error Setting Certificate Verify Locations: Cafile: /path/to/downloaded/cacert.pem Capath: None in C: wamp www alerts_monolog vendor monolog monolog src Monolog Handler Curl Util.php:53 Stack trace: #0

What can I do ?

I don’t know if it’s in the code, but here’s the code

<?php 

use Monolog\Handler\BrowserConsoleHandler;
use Monolog\Handler\SendGridHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\TelegramBotHandler;
use Monolog\Formatter\LineFormatter;
use Monolog\Logger;

require __DIR__."/vendor/autoload.php";

$logger = new Logger("web");
$logger->pushHandler(new BrowserConsoleHandler(Logger::DEBUG));
$logger->pushHandler(new StreamHandler(__DIR__."/log.txt",Logger::WARNING));
$logger->pushHandler(new SendGridHandler("apikey","password","[email protected]","meu@email","nome_do_site_aqui: ".date("d/m/Y H:i:s"),Logger::CRITICAL));

$logger->pushProcessor(function($record){
    $record["extra"]["HTTP_HOST"] = $_SERVER["HTTP_HOST"];
    $record["extra"]["REQUEST_URI"] = $_SERVER["REQUEST_URI"];
    $record["extra"]["REQUEST_METHOD"] = $_SERVER["REQUEST_METHOD"];
    $record["extra"]["HTTP_USER_AGENT"] = $_SERVER["HTTP_USER_AGENT"];
    return $record;

});

$tele_key = "TELEKEY";
$tele_channel = "@GRUPOKEY";
$tele_handler = new TelegramBotHandler($tele_key, $tele_channel,Logger::EMERGENCY);
$tele_handler->setFormatter(new LineFormatter("%level_name%: %message%"));
$logger->pushHandler($tele_handler);

//DEBUG
$logger->debug("Olá Mundo", ["logger" =>true]);
$logger->info("Olá Mundo", ["logger" =>true]);
$logger->notice("Olá Mundo", ["logger" =>true]);

//FILE LOG
$logger->warning("Olá Mundo", ["logger" =>true]);
$logger->error("Olá Mundo", ["logger" =>true]);

//EMAIL
$logger->critical("Olá Mundo", ["logger" =>true]);
$logger->alert("Olá Mundo", ["logger" =>true]);

$logger->emergency("Essa mensagem foi enviada pelo Monolog!");
  • Edit php.ini, there you will find php.ini curl.cainfo=, points at the location ... download the file at http://curl.haxx.se/ca/cacert.pem

  • The right answer puts it as an answer and I mark it as correct. I’ve been working on these options Curl.cainfo="C: wamp bin php php7.3.1 extras ssl cacert.pem" openssl.cafile="C: wamp bin php php7.3.1 extras ssl cacert.pem"

1 answer

1


For Curl you must edit the php.ini line in:

curl.cainfo=

And for others you must edit

openssl.cafile=

You can download the cacert.pem:

And then it fits like this:

curl.cainfo=unidade://local/aonde/baixou/o/certificado/cacert.pem

Browser other questions tagged

You are not signed in. Login or sign up in order to post.