Get Fatal Error Using Book Post with Drupal 5.5

terryit3 - October 21, 2008 - 14:54
Project:Book Post
Version:6.x-1.2-beta1
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

I create a new Page with Filtered Input and add {{ISBN NUMBER HERE}} to the body, publish it and the page displays this error message:

Fatal error: Uncaught exception 'Exception' with message 'Open Library Data Unavailable' in /var/www/modules/bookpost/bookpost.module:241 Stack trace: #0 /var/www/modules/bookpost/bookpost.module(107): get_url_contents('http://openlibr...', NULL) #1 /var/www/modules/bookpost/bookpost.module(51): retrieve_bookdata('0060858206') #2 [internal function]: bookpost_filter('process', '0', '1', '{{0060858206}}?') #3 /var/www/includes/module.inc(386): call_user_func_array('bookpost_filter', Array) #4 /var/www/modules/filter/filter.module(774): module_invoke('bookpost', 'filter', 'process', '0', '1', '{{0060858206}}?') #5 /var/www/modules/node/node.module(728): check_markup('{{0060858206}}?...', '1', false) #6 /var/www/modules/node/node.module(766): node_prepare(Object(stdClass), false) #7 /var/www/modules/node/node.module(689): node_build_content(Object(stdClass), false, true) #8 /var/www/modules/node/node.module(779): node_view(Object(stdClass), false, true) #9 /var/www/modules/node/node.module(2468): node_show(Object(stdClass), in /var/www/modules/bookpost/bookpost.module on line 241

Any ideas?

#1

rubinsztajn - October 21, 2008 - 15:25

Do you have the PHP cURL extension? The module requires the cURL and JSON PHP extensions. They both compile by default with PHP 5.2 but might have to be added to earlier versions of PHP.

#2

terryit3 - October 21, 2008 - 15:42

I have the cURL extension enabled, but not the JSON extension enabled.
If you know any easy way of compiling this, please share :)
Installing any PHP extensions always gives me problems.

Thank you for your reply!
T

#3

rubinsztajn - October 21, 2008 - 18:09

Well, the best way is to recompile PHP with the JSON extension. If you are running Debian or Ubuntu, it's as easy as:

$ sudo apt-get install php5-json

Another option is to install JSON.php through pear. You can also just download the file and place it in the bookpost module folder. If you install from pear or place the JSON.php file in the module folder, you'll need to add this line to the top of the module source:

<?php
require_once 'JSON.php';
?>

You're likely not alone in using a PHP5 version earlier than 5.2 so it probably makes sense for me to make a user friendly way of adding the JSON extension to the module.

Let me know how it goes.

#4

terryit3 - October 24, 2008 - 12:11

I am using Ubuntu, but apt-get said there was no package for php5-json.
I was able to install JSON through PECL however.

Now it's a different problem..

When I publish a page, I get this error:

warning: getimagesize(http://covers.openlibrary.org/b/olid/-M.jpg) [function.getimagesize]: failed to open stream: HTTP request failed! in /var/www/modules/bookpost/bookpost.module on line 178.

#5

rubinsztajn - October 24, 2008 - 13:45

It's possible that the Open Library was down when you tried to make the request. Try again and see of you have the same problem.

If it still doesn't work, let me know a little more about your setup.

By the way, is there a reason why you haven't updated Drupal to 5.11? I doubt it's relevant but you never know...

#6

terryit3 - October 24, 2008 - 14:29

I tried to submit a new page for a Harry Potter book and this time I got the same error in my original post.
If I retry, sometimes it gives me the "getimagesize" error, sometimes it gives me the original error. There doesn't seem to be a pattern in the errors.

I am running Ubuntu Hardy with PHP 5 and MySQL 5. I have quite a few third party modules installed. I'm not sure what information you need exactly, but I will provide you with whatever you need if it will get this module working :)

I've attached a copy of my phpinfo results.

Oh and I just updated to 5.12. I wasn't aware there was an update.

Thanks again

AttachmentSize
phpinfo.pdf 120.88 KB

#7

rubinsztajn - October 24, 2008 - 15:04

Would you be willing to try an experiment for me?

Delete line 241 of the bookpost.module file. It should look like this:

<?php
if ($output == "") throw new Exception("Open Library Data Unavailable");
?>

Try posting an ISBN again and let me know what happens.

Thanks!

#8

terryit3 - October 24, 2008 - 15:45

Still getting this error:

warning: getimagesize(http://covers.openlibrary.org/b/olid/-M.jpg) [function.getimagesize]: failed to open stream: HTTP request failed! in /var/www/modules/bookpost/bookpost.module on line 178.

#9

rubinsztajn - October 24, 2008 - 17:10

Are you still encountering your original error or did deleting the line of code solve that problem?

I can't seem to duplicate the other error. Is "allow_url_fopen" set to "On" in your php.ini file?

#10

terryit3 - October 24, 2008 - 17:46

Still getting this error:

warning: getimagesize(http://covers.openlibrary.org/b/olid/-M.jpg) [function.getimagesize]: failed to open stream: HTTP request failed! in /var/www/modules/bookpost/bookpost.module on line 178.

allow_url_fopen = On in my php.ini file.

#11

terryit3 - October 24, 2008 - 17:48

I turned allow_url_fopen off and get this error:

    * warning: getimagesize() [function.getimagesize]: URL file-access is disabled in the server configuration in /var/www/modules/bookpost/bookpost.module on line 178.
    * warning: getimagesize(http://covers.openlibrary.org/b/olid/-M.jpg) [function.getimagesize]: failed to open stream: no suitable wrapper could be found in /var/www/modules/bookpost/bookpost.module on line 178.

#12

rubinsztajn - October 24, 2008 - 17:58

What happens when you type the url, http://covers.openlibrary.org/b/olid/-M.jpg, into your browser? If you connect successfully, you should get a blank page...

#13

terryit3 - October 24, 2008 - 17:59

I get a blank page.
It says GIF Image 1x1 pixels.

#14

terryit3 - October 24, 2008 - 18:38

Well, for no reason at all, the image started displaying..
The error is still there though.

AttachmentSize
screenshot.jpeg 70.55 KB

#15

rubinsztajn - October 24, 2008 - 19:30
Title:Get Fatal Error Using Book Post with Drupal 5.5» getimagesize() causes warning Formerly: [Get Fatal Error Using Book Post with Drupal 5.5]

I'm not sure exactly what's causing the warning in your case but I'm glad it's not interfering with the module's functioning. The reason why you weren't seeing an image before was because for some reason the ISBN you entered wasn't getting properly turned into an OL id, which is used to download the cover. Comapre the url from your other errors: http://covers.openlibrary.org/b/olid/-M.jpg, with the url in your screenshot.

It's possible that the module was replaying old cached results that were somehow cleared before you made your most recent post.

#16

terryit3 - October 24, 2008 - 19:37
Title:getimagesize() causes warning Formerly: [Get Fatal Error Using Book Post with Drupal 5.5] » Get Fatal Error Using Book Post with Drupal 5.5

The page displaying the info and cover was a one time thing.. I'm back to this error:

warning: getimagesize(http://covers.openlibrary.org/b/olid/-M.jpg) [function.getimagesize]: failed to open stream: HTTP request failed! in /var/www/modules/bookpost/bookpost.module on line 178.

If I try to view a page that uses the book_post module, it takes about a minute to display a page with that error..
Something is definitely screwy with my PHP config..

 
 

Drupal is a registered trademark of Dries Buytaert.