4

What does this error mean with the Youtube API v3.0:

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

I am using the PHP Youtube API on Google's documentation found here.

Jordan Tigani
  • 26,089
  • 4
  • 60
  • 63
Someone
  • 428
  • 5
  • 17
  • 2
    When the client library can't create a storage directory, there's a problem on your server ... the permissions, perhaps, or running out of disk space, or something of that nature. – jlmcdonald Jun 25 '13 at 04:29

6 Answers6

13

I solved this problem without changing any line of Google API. In your php code, you juste need to specify where you want the cache folder to be:

$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

It works fine for me using the Google Calendar Service.

Kevin Kopf
  • 13,327
  • 14
  • 49
  • 66
WebEtAlors.fr
  • 196
  • 1
  • 5
3

I was having a similar issue. I am on a shared hosting.

I was working on youtube api which was asking me to create Google_Client folder under the main \tmp on the server. Due to restriction that was not happening so I went into the

google-api-php-client/src/conifg.php and changed the following line.

    /***********************************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',

Then I created a tmp directory under google-api-php-client/src

Then I created a Google_Client directory under google-api-php-client/src/tmp

This worked for me. Hope this helps. If yes then mark it as answer as many folks are having the same problem.

Talha
  • 1,546
  • 17
  • 15
2

For me,

at Config.php line94:

change >> 'directory' => sys_get_temp_dir() . '/Google_Client'

for >> 'directory' => '../tmp/Google_Client'

or any other dir you want

Alberto Fortes
  • 562
  • 4
  • 13
0

Probably easier/better ways to do this, but i'm on my own macbook air:

i'm running xampp. I'm using the default 'htdocs' dir, '/Applications/XAMPP/htdocs'.

so i:

  1. went to that htdocs dir and ran "mkdir tmp; chmod 777 tmp"

  2. commented out original ioFileCache_directory line and added my own:

    // IO Class dependent configuration, you only have to configure the values // for the class that was configured as the ioClass above

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

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

That's it. Don't think I had to restart Apache.

Peter Smith
  • 534
  • 2
  • 8
  • 19
0

Use this in your PHP code:

$client = new Google_Client();
$client->setCache(new Google_Cache_File('/path/to/shared/cache'));
Pamela
  • 507
  • 6
  • 23
  • adding this line did not fix my issue. but did give me a new error. Argument 1 passed to Google_Cache_File::__construct() must be an instance of Google_Client, string given – Mike Volmar Oct 07 '16 at 13:45
0

Are you Super-User?

su
password

and it worked for me

Paul Roub
  • 36,322
  • 27
  • 84
  • 93
Gianluca Demarinis
  • 1,964
  • 2
  • 15
  • 21