Client error occurred: Failed to create storage directory: / tmp / Google_Client / 00

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

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

I am using the Youtube PHP API in the google documentation found here .

+4
source share
6 answers

I solved this problem without changing any line of Google APIs. In your php code you 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 great for me using Google Calendar Services.

+11
source

I had a similar problem. I am on shared hosting.

I was working on a youtube api that asked me to create a Google_Client folder under the main \ tmp on the server. Due to restrictions that were not there, so I went to

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

  /***********************************Shared server therefore cannot write to server /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 the tmp directory under google-api-php-client / src

Then I created the Google_Client directory in google-api-php-client / src / tmp

It worked for me. Hope this helps. If so, mark this as an answer, as many people have the same problem.

+3
source

For me

in Config.php line94:

change β†’ 'directory' => sys_get_temp_dir (). '/ Google_Client'

for β†’ 'directory' => '../tmp/Google_Client'

or any other directory you want

+2
source

This is probably easier / better, but I'm in my own macbook air:

I am running xampp. I use the default 'htdocs' dir, '/ Applications / XAMPP / htdocs'.

therefore i:

  • went to this htdocs directory and ran "mkdir tmp; chmod 777 tmp"

  • commented out the original ioFileCache_directory line and added your own:

    // The configuration is dependent on the IO class, you only need to adjust the // values ​​for the class that was configured as 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'), * /

What is it. Do not think that I had to restart Apache.

0
source

Use this in your PHP code:

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

Are you superuser?

 su password 

and it worked for me

0
source

Source: https://habr.com/ru/post/1487945/


All Articles