Cara menggunakan php curl error 60

Jika Anda mengembangkan situs Drupal pada localhost, kemungkinan bisa terjadi masalah saat akan mencoba menginstal module/tema baru drupal melalui url [secara online]. Dalam contoh kasus yang saya alami, terjadi masalah error dengan pesan seperti berikut ini

Failed to fetch file due to error "cURL error 60: SSL certificate problem: unable to get local issuer certificate [see //curl.haxx.se/libcurl/c/libcurl-errors.html]"
Unable to retrieve Drupal project from…….

Baca juga : Cara Instal Modul Baru di Drupal 8

Jika Anda mengalami masalah seperti diatas saat akan mencoba menginstal module baru di drupal 8, maka kalian bisa mengatasinya dengan cara berikut ini

Mengatasi Error Drupal 8 cURL error 60: SSL certificate problem

  1. Unduh dulu certificate / cacert.pem pada halaman berikut

  2. Setelah di unduh, rename filenya jadi cacert.pem lalu extract/copy filenya ke C:\Windows
  3. Kemudian buka file konfigurasi yaitu php.ini, pada bagian paling bawah tambahkan baris curl.cainfo = "C:\Windows\cacert.pem" 

  4. Terakhir restart Web Server lalu jalankan kembali

Sampai disini proses penangan masalah error tersebut sudah selesai, Anda dapat mencoba kembali untuk menginstal module

Seorang laki - laki biasa yang senang duduk sendirian di pinggir pantai, pengagum embun pagi dan lembayung senja, suka blogging, coding dan jogging. Moto hidupnya adalah hidup santai dan simpel

The behaviour of these functions is affected by settings in php.ini.

cURL Configuration OptionsNameDefaultChangeableChangelog
curl.cainfo NULL PHP_INI_SYSTEM  

For further details and definitions of the PHP_INI_* modes, see the Where a configuration setting may be set.

Here's a short explanation of the configuration directives.

curl.cainfo string

A default value for the CURLOPT_CAINFO option. This is required to be an absolute path.

ajith at pavanathara dot com

2 years ago

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

This local development error comes when curl.cainfo variable is not set correctly.

I faced this issue in PHP Version 7.3.1

In order to fix the error, I downloaded cacert.pem from //curl.haxx.se/docs/caextract.html

Set the following paths in php.ini

curl.cainfo="D:\wamp64\bin\php\php7.3.1\extras\ssl\cacert.pem"
openssl.cafile="D:\wamp64\bin\php\php7.3.1\extras\ssl\cacert.pem"

Even after adding the paths and restart Apache, Inside phpinfo[], both the paths were showing blank.

The error will go only if we set via php code of the project.

Example code worked for me :-

$guzzle = new \GuzzleHttp\Client[['verify' => 'D:\wamp64\bin\php\php7.3.1\extras\ssl\cacert.pem']];

ajith at pavanathara dot com

2 years ago

I was editing wrong php.ini file in last comment.

Even though loaded configuration path was showing as "D:\wamp64\bin\apache\apache2.4.37\bin\php.ini" inside phpinfo[] of WAMP Server, It was actually loading "D:\wamp64\bin\apache\apache2.4.37\bin\phpForApache.ini"

Once I set both the variables inside phpForApache.ini, details are displayed in phpinfo[] and error has gone without extra coding line.

knuklus at gmail dot com

1 year ago

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

This problem can occur when developing locally on windows. I am using windows 10 [x64]

In order to fix the error, I downloaded cacert.pem from //curl.haxx.se/docs/caextract.html

Set the following value for in php.ini

curl.cainfo = "C: \ php-8.0.7 \ extras \ ssl \ cacert.pem"

ASchmidt at Anamera dot net

3 years ago

As of PHP 7.2 [Win 64] this directive, will NOT show in the phpinfo[] even though it's set.

[In comparison, an openssl.cafile directive will show, if it's set to the exact same path].

Bài mới nhất

Chủ Đề