0

The Google API PHP Client library has a file named Config.php. I'm getting an error from that file, from line 139.

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

The error is:

Fatal error: Call to undefined function sys_get_temp_dir() in C:\Users\NoName\Documents\academic-being-90217\google-api-php-client\src\Google\Config.php on line 139

Here is a link to the file in GitHub:

GitHub file - Config.php

Why am I getting that error?

Do I need to create a temp directory? There is no temp directory defined.

The PHP function sys_get_temp_dir()

Returns the path of the directory PHP stores temporary files in by default

I'm running this code from Google App Engine Launcher on my computer. Does that make a difference, as opposed to running it from the host server?

I created a temp directory under google-api-php-client/src/Google but that didn't stop the error.

I'm beginning to wonder if this is an internal issue with Google App Engine Launcher, and whether the sys_get_temp_dir() function is available to it.

If all I do is run just one line of code:

<?php

  $thisIsATest = sys_get_temp_dir();
  return;

I get the same error. So that error has nothing to do with any other part of the code.

I guess that I could hard code a directory path, and make sure there is a folder there to be available to use.

'directory' => 'src/Google/temp/Google_Client'

Well, if I hard code a directory path for that line, I don't get an error any more. But I'm not sure I've got the path set up correctly.

Alan Wells
  • 30,746
  • 15
  • 104
  • 152
  • What version of PHP are you using? Also, open your `php.ini` file and search for `disable_functions`. Is `sys_get_temp_dir` there? – Sverri M. Olsen Apr 04 '15 at 04:06
  • I've got the app.yaml set to 5.5. `runtime: php55` – Alan Wells Apr 04 '15 at 04:09
  • I don't have a `php.ini` file. – Alan Wells Apr 04 '15 at 04:10
  • Yes, you do. Open a terminal (Windows button, type `cmd` and hit Enter). Type `php --ini` and hit Enter. There should be a "Loaded Configuration File:". – Sverri M. Olsen Apr 04 '15 at 04:13
  • Your right. I have one php.ini file in `C:\Program Files(x86)\Google\Google_appengine\demos\php\minishell` The contents are: `; Re-enable these soft disabled functions for minishell users. google_app_engine.enable_functions = "phpinfo, php_uname, php_sapi_name"` When I use: `php --ini` on the windows command line I get the msg: `php is not recognized as an internal or external command, etc` – Alan Wells Apr 04 '15 at 13:32
  • How are you running your app? Did you use the launcher or command line? – Mars Apr 06 '15 at 17:28
  • Launcher, don't ever use the command line. – Alan Wells Apr 06 '15 at 17:31
  • The launcher should pick up the bundled PHP interpreter automatically, and if you're using php55, sys_get_temp_dir() should return a temporary in-memory file (https://cloud.google.com/appengine/docs/php/#PHP_Disabled_functions) – Mars Apr 06 '15 at 17:38

0 Answers0