Error when using Google's PHP client library in a module directory
Hi,
I am working on a module that would display relevant videos form youtube alongside the content of a certain type. For this I need to use Google's PHP client library (http://framework.zend.com/download/gdata/) distributed with the Zend framework.
When I place the library folder in my module directory and use the following code
<?php
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_YouTube');
?>I get an error message that says
Fatal error: Zend_Loader::require_once() [function.require]: Failed opening required 'Zend/Exception.php' (include_path='.:/usr/share/php') in /var/www/ilb_kaka/sites/all/modules/custom/ilb_blocks/Zend/Loader.php on line 87This means that Loader.php file is getting included alright but then PHP is not able to include Exception.php (on line 87)
I have also tried including the file as
<?php
require_once(drupal_get_path('module', 'modulename') . '/Zend/Loader.php');
?>But it gives the same error message.
Whats interesting is that
* I do not get any error messages at all when I use the library with a stand alone php script (not a part of drupal setup)
* I have checked (a thousand times actually) and the file permissions are right
* The library works with drupal module when I place in the php include path (but I do not want to do that as it makes a lot more sense to have it in the modules directory)
* There is something similar going on (here http://drupal.org/node/304709) but with no replies :(
Can anyone tell what I am doing wrong? OR how I can get this to work?

Use the zend framework
I would recommend that you use the Zend Framework module.
http://drupal.org/project/zend
it explains how to initialize any library, and takes care of all the problems.
Tried using the Zend
Tried using the Zend framework module too.. but it gives me the error that is discussed here http://drupal.org/node/304709 :(
your not loading properly.
Read the Zend Framework module docs. You have to properly load the required modules like this,
<?phpif (zend_initialize('Zend_Search_Lucene')) {
$index = Zend_Search_Lucene::open('/data/my_index');
$index->find($query);
}
else {
drupal_set_message(t('Zend Lucene Search initialization failed.'));
}
?>
the zend_initialize() function will load the proper framework modules. and you should't get that error
basically don't load the modules the way the Zend Frameworks says to. or you will get your error. load it through the zend_initialize() function instead