2017-11-01 7 views
-1

私はSSLエラーのGoogleドライブAPI

include_once ROOT.'/google-api-php-client/vendor/autoload.php'; 

$client = new Google_Client(); 

$credentialsFile = ROOT.'/google-api-php-client/service_account.json'; 
if (!file_exists($credentialsFile)) { 
    throw new RuntimeException('Service account credentials Not Found!'); 
} 

$client->setAuthConfig($credentialsFile); 
$client->setScopes(Google_Service_Drive::DRIVE); 

$service = new Google_Service_Drive($client); 

/** 
    * Проверка существования папки для документов 
    */ 

$optParams = array(
    'q' => "name='Документы'" 
); 
$results = $service->files->listFiles($optParams); 
if (count($results->getFiles()) == 0) { 
exit('Нет папки для документов'); 
} else { 
    foreach ($results->getFiles() as $file) { 
$papka_doc = $file->getId(); 
    } 
} 

すべてが働いていたが、数日前に、エラーが発生したドライブのファイルを検索したり、GoogleにアップロードするPHPライブラリを使用しています:

 
Uncaught exception 'GuzzleHttp\\Exception\\RequestException' with message 'cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) 

何が問題なのでしょうか?

答えて

0

まず、あなたは、curl.certのファイルをダウンロードしてください第二に

curl https://curl.haxx.se/ca/cacert.pem -o /etc/pki/tls/certs/ca-bundle.crt 

、この証明書を設定し、これを試してみてください。

$client->getHttpClient()->setDefaultOption('verify', '[Certificate File Path]'); 

デフォルトのパス。

/etc/pki/tls/certs/ca-bundle.crt 
+0

残念ながら、このメソッドは役に立たなかった –

関連する問題