【问题标题】:A client error occurred: Could not create storage directory: /tmp/Google_Client/00发生客户端错误:无法创建存储目录:/tmp/Google_Client/00
【发布时间】:2013-06-21 09:32:47
【问题描述】:

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

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

我正在使用 Google 文档中的 PHP Youtube API here

【问题讨论】:

  • 当客户端库无法创建存储目录时,您的服务器出现问题...权限,可能,或磁盘空间不足,或类似性质。

标签: php youtube-api google-api-php-client


【解决方案1】:

你是超级用户吗?

su
password

它对我有用

【讨论】:

    【解决方案2】:

    在你的 PHP 代码中使用它:

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

    【讨论】:

    • 添加这一行并没有解决我的问题。但确实给了我一个新的错误。传递给 Google_Cache_File::__construct() 的参数 1 必须是 Google_Client 的实例,给定字符串
    【解决方案3】:

    我在不更改任何 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
    

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

    【讨论】:

      【解决方案4】:

      对我来说,

      在 Config.php 第 94 行:

      更改 >> '目录' => sys_get_temp_dir() 。 '/Google_Client'

      对于 >> '目录' => '../tmp/Google_Client'

      或您想要的任何其他目录

      【讨论】:

        【解决方案5】:

        可能更容易/更好的方法来做到这一点,但我在我自己的 macbook air 上:

        我正在运行 xampp。我正在使用默认的“htdocs”目录“/Applications/XAMPP/htdocs”。

        所以我:

        1. 转到那个 htdocs 目录并运行“mkdir tmp; chmod 777 tmp”

        2. 注释掉原来的 ioFileCache_directory 行并添加我自己的:

          // IO类依赖配置,只需要配置值 // 对于上面配置为ioClass的类

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

          /* 'ioFileCache_directory' => (function_exists('sys_get_temp_dir') ? sys_get_temp_dir() 。 '/Google_Client' : '/tmp/Google_Client'), */

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

        【讨论】:

          【解决方案6】:

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

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

          google-api-php-client/src/conifg.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',
          

          然后我在google-api-php-client/src下创建了一个tmp目录

          然后我在google-api-php-client/src/tmp下创建了一个Google_Client目录

          这对我有用。希望这可以帮助。如果是,则将其标记为答案,因为很多人都遇到了同样的问题。

          【讨论】:

            猜你喜欢
            • 2021-11-30
            • 1970-01-01
            • 1970-01-01
            • 2021-12-24
            • 1970-01-01
            • 1970-01-01
            • 2015-04-01
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多