COPS : Calibre OPDS PHP Server
#11  CBebop 04-09-2012, 12:15 PM
Quote vlad59
The only nginx specific code is the use of the header X-Accel-Redirect to handle the download of files outside your web directory.

I believe that lighttpd has almost the same feature with x-sendfile (I'll let you google it if needed) so it shouldn't be hard to add (3-5 line change) assuming you're willing to test.
I would be more than willing to test if you need me to. If there is a better place to coordinate a test, let me know (AIM, IRC, <insertChatClient>).

#12  vlad59 04-13-2012, 04:54 PM
COPS 0.0.2 is out with the following changes (First post to download) :
I've updated the demo to add a .Mobi and a .PDF to the book Alice in Wonderland. I have no access to any OPDS client that can download .Mobi but Mantano show the PDF correctly.

Happy testing.

@CBebop : I'll find some time next week to help you test COPS on lighttpd.

#13  gaspine 04-14-2012, 04:27 AM
Love cops, thanks for the great work.

i'm working on the opposite side of cops, making the library.

I'm in the process of making a script who scan a directory with pub file and create / update the calibre database sqlite3 file and create the cover / metadata.

The ultimate goal si to use my NAS to organise my epub book, juste put the .epub file in a ftp directory, a script scan the new file and organise them.

i've a problem open the calibre sqlite 3 file, he say me "function XX" not found, did you have the same ?

Thanks anyway

Ps : i test it on my ipad / apache
you have miss the forget :
in OPDS_renderer.php

#14  vlad59 04-16-2012, 04:19 AM

Thanks for the error report, I fixed it yesterday. I'll publish a new release in 2 or 3 days.

I had no problem opening Calibre database with sqlite3 on Linux or sqliteadmin on Windows or with PHP. Maybe I can help you if give more information by mail or PM.

#15  b1ackmai1er 05-02-2012, 12:11 PM
Hi Guys,

Anyone able to assist with the install on this?

I have installed fastcgi, php5 and nginx and the COPS files and updated the nginx.conf and config_local.php configuration but received "Error 502 Bad gateway" messages when I load the site.

The error log reports: connect to unix:/tmp/fcgi.sock failed (2: No such file or directory)

The nginx.conf files refers to this directory in the line:

fastcgi_pass unix:/tmp/fcgi.sock;

So I change this to


But the I received the error:

[error] 4215#0: *1 upstream sent unsupported FastCGI protocol version: 72 while reading response header from upstream, client:, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://", host: "box"

So I worked out I had to run fastcgi:

php-cgi -b

But now I get the following error:

XML Parsing Error: syntax error
Location: http://box/
Line Number 1, Column 1:exception 'PDOException' with message 'could not find driver' in /usr/local/html/base.php:223

At this stage I am lost. The COPS files are stored in /usr/local/html/ including the base.php file.

Edit 1: I realize now the XML error is generated by my web browser. The actual page source lists the errors:

exception 'PDOException' with message 'could not find driver' in /usr/local/html/base.php:223
Stack trace:
#0 /usr/local/html/base.php(223): PDO->__construct('sqlite:/usr/loc...')
#1 /usr/local/html/author.php(33): Base::getDb()
#2 /usr/local/html/base.php(123): Author::getCount()
#3 /usr/local/html/feed.php(30): Page->InitializeContent()
#4 {main}exception 'PDOException' with message 'could not find driver' in /usr/local/html/base.php:223
Stack trace:
#0 /usr/local/html/base.php(223): PDO->__construct('sqlite:/usr/loc...')
#1 /usr/local/html/author.php(33): Base::getDb()
#2 /usr/local/html/base.php(123): Author::getCount()
#3 /usr/local/html/feed.php(30): Page->InitializeContent()
#4 {main}

Edit 2: I made some further progress - php.ini needed the pdosqlite extension added:

Unfortunately, I now get the error:

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/' - /usr/local/lib/php/extensions/no-debug-non-zts-20090626/ undefined symbol: sqlite3_libversion in Unknown on line 0

It seems my PHP5 is compiled for the wrong sqlite version ???

from phpinfo()

SQLite support enabled
PECL Module version 2.0-dev $Id: sqlite.c 306939 2011-01-01 02:19:59Z felipe $
SQLite Library 2.8.17
SQLite Encoding iso8859

PDO support enabled
PDO drivers odbc, sqlite2

A bit confused at this stage as the sqlite library is


Can anyone help? Thanks.

#16  micster 05-04-2012, 02:21 AM
I'm interested in this script for many of the same reasons that you created it, but there is one feature I would like to achieve... Is it possible to also make a web browsable catalog?

Calibre2opds achieves this by generating HTML files for the website and XML files for the OPDS catalog. I like the way that the two match and would very much like to use a regular web browser and my opds capable ereader for navigating my collection.

I would appreciate any information you might have that could help me out with this.

#17  gaspine 05-04-2012, 03:51 AM
@blackmailer : php si a bit confusing with sqlite.
Thé calibre database si sqlite 3 version.
I ve succesfully installés cops in an Apache environnement maybe it's easier to do in that way.

For the last post, opds si à better protocol to browse à catalog, in i remembre calibre 2opds build static html ADN you néed to rebuild them. In you ré reader si opds compatible keep cops

#18  micster 05-06-2012, 08:50 PM
I'm getting this error message
Fatal error: Call to a member function fetchColumn() on a non-object in /var/www/author.php on line 33
From the research I've done through Google it appears that it is having trouble connecting to the database. One of the suggestions I got was to make sure "php_pdo_sqlite extension is enabled in PHP". I think this is true but I am not sure.

I'm running Apache2.

#19  micster 05-06-2012, 09:13 PM
Doh! I fixed my problem and it was pretty stupid...

In the config_local.php file I had the variable:
PHP Code
$config['calibre_directory'] = '/var/www/books'
When it should have been:
PHP Code
$config['calibre_directory'] = '/var/www/books/'
Notice the '/' at the end? Such a small thing that took me several hours to find.

#20  vlad59 05-07-2012, 08:47 AM

I agree with Gaspine thought, you have a to use a Sqlite3 driver to open Calibre's database.

What OS are you using ? from the directory you typed it doesn't appear to be any variant of Debian or Arch.

Have you restarted your php fastcgi after installing sqlite package ?


Sorry for the lost hours

I'll add a warning in next release (should be later today).

About your other question about a web browsable catalog, I'm currently coding it, I'll post a link to my work in progress later.

 « First  « Prev Next »  Last »  (2/181)
Today's Posts | Search this Thread | Login | Register