You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Warning: file_exists(): open_basedir restriction in effect. File(/tmp/Google_Client/xx/xxx...) is not within the allowed path(s) #713
I'm developing a web application in php and i downloaded the API from here and followed the guides but when i try to run it it gave me this error:
Warning: file_exists(): open_basedir restriction in effect. File(/tmp/Google_Client/9d/9dac732490e227eb6b11f1cbf0e36d47) is not within the allowed path(s): (/www) in /www/MW_qPRcycRIG/massimopiccioni.it/Test/AnalyticsAPITest/google-api-php-client/src/Google/Cache/File.php on line 52 Warning: is_dir(): open_basedir restriction in effect. File(/tmp/Google_Client/9d) is not within the allowed path(s): (/www) in /www/MW_qPRcycRIG/massimopiccioni.it/Test/AnalyticsAPITest/google-api-php-client/src/Google/Cache/File.php on line 148 Warning: mkdir(): open_basedir restriction in effect. File(/tmp/Google_Client) is not within the allowed path(s): (/www) in /www/MW_qPRcycRIG/massimopiccioni.it/Test/AnalyticsAPITest/google-api-php-client/src/Google/Cache/File.php on line 149 Fatal error: Uncaught exception 'Google_Cache_Exception' with message 'Could not create storage directory: /tmp/Google_Client/9d' in /www/MW_qPRcycRIG/massimopiccioni.it/Test/AnalyticsAPITest/google-api-php-client/src/Google/Cache/File.php:154 Stack trace: #0 /www/MW_qPRcycRIG/massimopiccioni.it/Test/AnalyticsAPITest/google-api-php-client/src/Google/Cache/File.php(139): Google_Cache_File->getCacheDir('ba077eabce470c1...', true) #1 /www/MW_qPRcycRIG/massimopiccioni.it/Test/AnalyticsAPITest/google-api-php-client/src/Google/Cache/File.php(134): Google_Cache_File->getCacheFile('ba077eabce470c1...', true) #2 /www/MW_qPRcycRIG/massimopiccioni.it/Test/AnalyticsAPITest/google-api-php-client/src/Google/Cache/File.php(95): Google_Cache_File->getWriteableCacheFile('ba077eabce470c1...') #3 /www/MW_qPRcycRIG/massimopiccioni.it/Test/AnalyticsAPITest/google-api-php-client/src/Google/Auth/OAuth2.php(322): Google_Cache_File->set('ba077eabce470c1...', '{"access_token"...') #4 /www/MW_qPRcycRIG/massimopiccioni.it/Test/AnalyticsAPITest/index in /www/MW_qPRcycRIG/massimopiccioni.it/Test/AnalyticsAPITest/google-api-php-client/src/Google/Cache/File.php on line 154
The 7th parameter to Google_Auth_AssertionCredentials is $useCache. This defaults to true. Try setting it to false, and the library will stop writing to a file.
I imagine this is because you're running in a shared hosting environment, and the php.ini setting open_basedir is set, and the cache file is attempting to write outside the allowed path. If you have access, you could also just disable open_basedir in your php.ini so that it is not in effect.
I got (nearly) the same problem. Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/tmp/Google_Client/19/19431c28c9844f253b7493fd88125111) is not within the allowed path(s): (/users/dmanstrator/www:/users/_temp/dmanstrator) in /users/dmanstrator/www/vendor/google/apiclient/src/Google/Cache/File.php on line 45
I went into the AssertionCredentials.php and changed the $useCache variable to be false as default ( $this->useCache = false;) but it doesn't change a thing.
I can't access my php.ini because I get hosted by bplaced.net, any tips for me?
Activity
bshaffer commentedon Oct 27, 2015
The 7th parameter to
Google_Auth_AssertionCredentialsis$useCache. This defaults to true. Try setting it to false, and the library will stop writing to a file.I imagine this is because you're running in a shared hosting environment, and the php.ini setting
open_basediris set, and the cache file is attempting to write outside the allowed path. If you have access, you could also just disableopen_basedirin yourphp.iniso that it is not in effect.DManstrator commentedon Feb 16, 2018
I got (nearly) the same problem.
Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/tmp/Google_Client/19/19431c28c9844f253b7493fd88125111) is not within the allowed path(s): (/users/dmanstrator/www:/users/_temp/dmanstrator) in /users/dmanstrator/www/vendor/google/apiclient/src/Google/Cache/File.php on line 45I went into the AssertionCredentials.php and changed the $useCache variable to be false as default (
$this->useCache = false;) but it doesn't change a thing.I can't access my php.ini because I get hosted by bplaced.net, any tips for me?
Thanks in advance.
Edit: After looking around, I found a way.
Just set the value of "directory" to one of the allowed paths.