0
votes

So I am trying to connect to a Google spreadsheet, to do that I am going to use the Zend Gdata framework. I try to connect to the google API like this:

set_include_path("$_SERVER[DOCUMENT_ROOT]/ZendGdata-1.12.11/library");

require_once 'Zend/Loader.php';

 $service = Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME;
 $client = Zend_Gdata_ClientLogin::getHttpClient('[email protected]', 'xxxxx', $service);
 $spreadsheetService = new Zend_Gdata_Spreadsheets($client);

but when I execute that code I get this error: www/ZendGdata-1.12.11/library Fatal error: Class 'Zend_Gdata_Spreadsheets' not found in /sites/xxxx.nl/www/test.php on line 26

I have no idea what is going wrong here, could you please help me out? :)

I also checked if the zend framework was installed correctly: enter image description here

1
check your include path again ? put a trailing slash after your include path like this $_SERVER[DOCUMENT_ROOT]/ZendGdata-1.12.11/library/ - almaruf
Still the same error :( - BjörnBogers

1 Answers

1
votes

The error suggests that the gdata library is not accessible to your PHP file.

If you are working in local environment, do the following steps:

  1. Open your "PHP.INI" file and find the string beginning with include_path which looks like this: include_path = ".: some other library path"

  2. This is a colon separated line and you need to append your gdata library path at the end.

  3. So your final include_path should look like:

include_path = ".: some other library path : your gdata library path"

Note: Make sure that you uncomment the include_path by removing the leading semicolon if any.

Else, if you are working on your hosting server you may not have direct access to the PHP.INI file, in this can you can do the following: 1. Open .htaccess file, if not exists create new tezt file and add the new entry:

php_value include_path('full path to your gdata library');

And save the file as .htaccess in the root directory of your server

That is it! Done!

Note: if you still get the same error make sure you edited the correct php.ini file and double check the path of your gdata library.