Now I 've got past the open_basedir problem, I can get to a page prompting for my Google username and password, and a button "Fetch private spreadsheets". But this returns an error "Error occurred /[mydrupalsite]/sheetnode/google/fetch". I've double-checked and I'm entering correct Google login details.

Comments

thebeepseal’s picture

OK, looks like this is another open_basdir problem:

warning: _sheetnode_google_import_fetch() [function.-sheetnode-google-import-fetch]: open_basedir restriction in effect. File(/Zend/Gdata/Spreadsheets.php) is not within the allowed path(s): (/var/www/vhosts/wales-lichens.org.uk/httpdocs:/tmp) in /var/www/vhosts/wales-lichens.org.uk/httpdocs/apprentices/sites/all/modules/sheetnode/sheetnode_google.import.inc on line 41.

warning: _sheetnode_google_import_fetch(Zend/Gdata/Spreadsheets.php) [function.-sheetnode-google-import-fetch]: failed to open stream: Operation not permitted in /var/www/vhosts/wales-lichens.org.uk/httpdocs/apprentices/sites/all/modules/sheetnode/sheetnode_google.import.inc on line 41.

So the offending line is:

require_once('Zend/Gdata/Spreadsheets.php');

and probably if this was fixed the next line would also cause a problem:

require_once('Zend/Gdata/ClientLogin.php');

But I'm not sure how to fix - these are files with php extension, not modules, and the posting at http://drupal.org/node/120538 suggests that the .php files should be OK. And as far as I can see, drupal_get_path only applies to theme, theme_engine, and module types.

I'm puzzled in any case how these files would be found anyway. I know the google sheetnode config page takes the full path to ZendGdata/library, but how does this get plugged in to the path in the require_once here? (I have tried hard-coding the full path here, but that didn't work either.
Cheers
Alan

infojunkie’s picture

In the sheetnode_google.module, the hook sheetnode_google_init adds the Zend Gdata path to the PHP include_path. This needs to occur at each page load, and that's why it's in hook_init. Hardcoding the path isn't an option either because you'd have to change all the Zend files as well.

I suggest moving the Zend library to your PHP include folder, such that the Zend/ folder (underneath ZendGdata-x.y.z/library/) is the one residing in the PHP include foder - hopefully open_basedir won't be offended there. In that case you can erase the "Zend Gdata library path" in Sheetnode Google Spreadsheets settings.

thebeepseal’s picture

Ah, I see.

I don't fully understand, though, what you mean by the PHP include folder. Isn't this whatever is set in include_path (and could be one of several folders). And if sheetnode_google_init appends a path to include_path, why is this different from using whatever path is already entered in include_path? I'm sorry if I'm being thick about this.

The include_path on my server is set by default to just ".:" - i.e. current directory . What I've done now is add the path to the include folder at the top level of my drupal site - so for me this is:

/var/www/vhosts/wales-lichens.org.uk/httpdocs/apprentices/includes

This seems to work in that I lose the open_basedir error message, and I don't get any other warning messages from Drupal. BUT - I still get the pop-up dialog "An error occurred: /apprentices/sheetnode/google/fetch"

infojunkie’s picture

What I meant by PHP include folder is any folder in the include_path. And yes, it should not make a difference if we add to the include_path at run-time or in php.ini, but then again the behaviour of your installation has been anything but standard!

I am reasonably sure that, given the pattern of errors you've been encountering on the site, the pop-up error you're witnessing now is still the failure to properly include the Zend files. Did you extract the Zend library to /var/www/vhosts/wales-lichens.org.uk/httpdocs/apprentices/includes ? Just make sure that for whichever folder you choose, you should add it to include_path in php.ini, and it's the Zend/ folder inside ZendGdata-x.y.z/library/ that should reside in it (such that require_once('Zend/Gdata/etc.') can work).

thebeepseal’s picture

Sorry I forgot to say - I did move Zend there, and I'm sure the application is finding it because at one point afterwards I was getting a warning relating to FeedEntryParent.php thus:

warning: main(Zend/Gdata/App/Extension/Element.php) [function.main]: failed to open stream: No such file or directory in /var/www/vhosts/wales-lichens.org.uk/httpdocs/apprentices/includes/Zend/Gdata/App/FeedEntryParent.php on line 26.

This turned out to be because I was missing the "Extension" folder under Gdata/App for some reason. After I put a new copy of the Zend library there (1.8.4 Patch 1) the above warning disappeared. But the warning did at least demonstrate the path was found.

However, still the pop-up error.

infojunkie’s picture

Good to know we're past the point of inclusion.

Is there a specific error message below "An error occurred" in the pop-up dialog?

thebeepseal’s picture

No there isn't - just "An error occurred: /apprentices/sheetnode/google/fetch"

infojunkie’s picture

Would you mind if I take a look at the site directly? I can't think of anything that could be wrong right now. Just provide me with a username / password that can create a sheetnode content and I'll try it. Use my contact form.

thebeepseal’s picture

Yes, that would be fine. I've just sent you login details. Many thanks. Alan

infojunkie’s picture

Thanks for the info. I still can't figure out what's going wrong. To make sure that the simplest case works, please add the following line at the very top of the _sheetnode_google_js function in sheetnode_google.module:

return drupal_json(array('status' => TRUE, 'data' => "Hello Drupal World"));

I'll check back with you later today (Sunday - my timezone is GMT-7). In the mean time, do you see the string "Hello Drupal World" when you click "Fetch private spreadsheets" ?

thebeepseal’s picture

Thanks for this. I've done what you suggested and yes - it does show "Hello Drupal World".

infojunkie’s picture

The Zend Framework used to access Google Spreadsheets requires PHP 5.2.4 or later whereas your installation is running PHP Version 5.0.4. I hope you can upgrade.

infojunkie’s picture

Status: Active » Fixed

Updated the Sheetnode Google module info file to check for PHP version.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.