出现客户端错误:无法创建存储目录:/tmp/Google_client/00


A client error occurred: Could not create storage directory: /tmp/Google_Client/00

这个错误对Youtube API v3.0:意味着什么

A client error occurred: Could not create storage directory: /tmp/Google_Client/00

我正在使用PHP Youtube API在这里找到的谷歌文档。

我在不更改任何Google API行的情况下解决了这个问题。在php代码中,您只需要指定缓存文件夹的位置:

$config = new Google_Config();
$config->setClassConfig('Google_Cache_File', array('directory' => '../tmp/cache'));
// Here I set a relative folder to avoid pb on permissions to a folder like /tmp that is not permitted on my mutualised host
$client = new Google_Client($config);
// And then,  you pass the config for your GoogleClient

使用谷歌日历服务对我来说效果很好。

我也遇到了类似的问题。我在共享主机上。

我正在开发youtube api,它要求我在服务器的主''tmp下创建Google_Client文件夹。由于没有发生限制,所以我进入了

googleapi-php-client/src/conping.php,并更改了以下行。

    /***********************************Shared server therefore cannot write to server's /tmp drive therefore using an alternate location*************************************************/
    //'ioFileCache_directory'  => (function_exists('sys_get_temp_dir') ? sys_get_temp_dir().'/Google_Client' : '/tmp/Google_Client'),
    'ioFileCache_directory'  => 'tmp/Google_Client',

然后,我在谷歌api php客户端/src 下创建了一个tmp目录

然后我在googleapi php Client/src/tmp 下创建了一个Google_Client目录

这对我很有效。希望能有所帮助。如果是,那么就把它标记为答案,因为很多人都有同样的问题。

对我来说,

在Config.php的第94行:

change>>'directory'=>sys_get_temp_dir()。'/Google_Client’

对于>>"目录"=>"/tmp/Google_Client’

或您想要的任何其他目录

这可能是更容易/更好的方法,但我使用自己的macbook air:

我正在运行xampp。我使用的是默认的"htdocs"目录,"/Applications/XAMPP/htdocs。"。

所以i:

  1. 转到htdocs目录并运行"mkdir tmp;chmod 777 tmp"

  2. 评论掉了原始的ioFileCache_directory行,并添加了我自己的:

    //IO类相关配置,您只需配置值//对于配置为高于的ioClass的类

    'ioFileCache_directory'=>'/Applications/XAMPP/htdocs/tmp/GoogleClient',

    /*'ioFileCache_directory'=>(函数存在('sys_get_temp_dir')?sys_get_temp_dir()。'/Google_Client':'/tmp/Google_Client'),*/

就是这样。我不认为我必须重新启动Apache。

在PHP代码中使用这个:

$client = new Google_Client();
$client->setCache(new Google_Cache_File('/path/to/shared/cache'));

你是超级用户吗?

su
password

它对我起作用