Php cron作业中的Google驱动器API错误

Php cron作业中的Google驱动器API错误,php,curl,ssl,google-drive-api,Php,Curl,Ssl,Google Drive Api,我在cpanel有一个cron工作,它连接到google drive,定期将网站文件和数据库备份到google drive帐户。我简化了文件以发现问题: <?php set_time_limit(0); require_once 'google-api-php-client/Google_Client.php'; require_once 'google-api-php-client/contrib/Google_DriveService.php'; $client = new Go

我在cpanel有一个cron工作,它连接到google drive,定期将网站文件和数据库备份到google drive帐户。我简化了文件以发现问题:

<?php

set_time_limit(0);

require_once 'google-api-php-client/Google_Client.php';
require_once 'google-api-php-client/contrib/Google_DriveService.php';

$client = new Google_Client();
$client>setClientId('xxxx');
$client->setClientSecret('xxxx');
$service = new Google_DriveService($client);

$accessToken = '{ "access_token" : "xxx", "token_type" : "Bearer", "expires_in" : 3600, 
"refresh_token" : "1/xxx" }';
$client->setAccessToken($accessToken);

$files = $service->files->listFiles();

print($files);

 ?>

cUrl无法将证书写入其目标

$ chmod 755 /etc/pki/tls/certs

或者为您使用的具有写入权限的证书显式设置一个新目标。

我也遇到了同样的问题,并更改了权限,但仍然无法使其正常工作。然后我找到了这个解决方案

在“google api php client\src\io\”文件夹中,打开“apiCurlIO.php” 代替 curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,true); 具有 curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false)


在长时间运行的Google Drive API作业中,我也看到脚本因此错误而崩溃,因为它们无法打开新文件。

cron上的不同cUrl设置?它无法验证SSL的证书。那么如何解释该证书或任何修复?在我的ftp中,我发现/etc/文件夹根本没有此路径..不知道为什么..我假设我的主机不支持SSL证书,因为我的cpanel中没有此选项
$ chmod 755 /etc/pki/tls/certs