Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Related Tools

Notices

Reply
 
Thread Tools Search this Thread
Old 07-26-2012, 05:56 AM   #241
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,703
Karma: 6658935
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Fooligan View Post
First of all thanks for the great work you did on this. Especially the different user (.htpasswd) function made my life a lot easier.
There's only one thing; I seem to have some problems with the search function in the PHP version. If I conduct a search all is well, if I conduct a second search, without logging out and in again, it only searches within the first search results. Is there a way, like in the original (kovidgoyal) version, to search from scratch?
I don't see that behavior.

Test:
1) go to the demo library http://charles.the-haleys.org/calibre/demo/
2) search for khalid. You will find one book, The Book of Khalid
3) search for Rohmer. You will find 14 books, none of which is the Book of Khalid.

I can't explain why your system is behaving the way you describe.
chaley is offline   Reply With Quote
Old 07-26-2012, 06:21 AM   #242
Fooligan
Junior Member
Fooligan began at the beginning.
 
Fooligan's Avatar
 
Posts: 3
Karma: 10
Join Date: Jul 2012
Device: iPhone 4S
Quote:
I don't see that behavior.

Test:
1) go to the demo library http://charles.the-haleys.org/calibre/demo/
2) search for khalid. You will find one book, The Book of Khalid
3) search for Rohmer. You will find 14 books, none of which is the Book of Khalid.

I can't explain why your system is behaving the way you describe.
Noticed that your server doesn't have this problem.
Just browsed through my log files. Seems to be a smarty problem on my side: Undefined variable: _SESSION in /usr/share/php/smarty/Smarty.class.php that keeps popping up. Will look further from here. Thanks for the quick reply!
Fooligan is offline   Reply With Quote
Old 07-26-2012, 06:25 AM   #243
Fooligan
Junior Member
Fooligan began at the beginning.
 
Fooligan's Avatar
 
Posts: 3
Karma: 10
Join Date: Jul 2012
Device: iPhone 4S
The problem was in smarty. I upgraded smarty to smarty-3.1.8 (which is still marked as unstable in Gentoo) and the problem is gone.
Fooligan is offline   Reply With Quote
Old 07-27-2012, 05:05 AM   #244
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
.....
ldolse is offline   Reply With Quote
Old 11-09-2012, 06:25 AM   #245
micster
Enthusiast
micster began at the beginning.
 
Posts: 39
Karma: 10
Join Date: May 2012
Device: none
Out of Memory

When I click on my "Titles" link to display all of the books in my database, PHP runs out of memory. I'm presented with a blank page and if I view the source the only thing displayed is a solitary "1".

I viewed my Apache error logs and I have one that says PHP ran out of memory while trying to run this script. The first time this happened I had around 7,000 book entries. I checked the memory setting in my "php.ini" and it was set to 128 megs. I thought this should have been enough, but I doubled it to 256 megs which made the problem go away.

I have since added many more books to my calibre database and I now have over 20,000 titles. Needless to say, every time I select to view all of my titles the script will crash with an out-of-memory error.

Is there anyway around this? Clicking on the other links is slow, but eventually they will display their info. I had a different script that would organize the titles into categories from A-Z and it would run fine. I'm thinking that the root of the problem is this one link that has 20,000 entries and if I could somehow break it up into smaller chunks I think it will work again.
micster is offline   Reply With Quote
Old 11-12-2012, 03:34 AM   #246
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,703
Karma: 6658935
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by micster View Post
When I click on my "Titles" link to display all of the books in my database, PHP runs out of memory. I'm presented with a blank page and if I view the source the only thing displayed is a solitary "1".

I viewed my Apache error logs and I have one that says PHP ran out of memory while trying to run this script. The first time this happened I had around 7,000 book entries. I checked the memory setting in my "php.ini" and it was set to 128 megs. I thought this should have been enough, but I doubled it to 256 megs which made the problem go away.

I have since added many more books to my calibre database and I now have over 20,000 titles. Needless to say, every time I select to view all of my titles the script will crash with an out-of-memory error.

Is there anyway around this? Clicking on the other links is slow, but eventually they will display their info. I had a different script that would organize the titles into categories from A-Z and it would run fine. I'm thinking that the root of the problem is this one link that has 20,000 entries and if I could somehow break it up into smaller chunks I think it will work again.
The problem arises because the db reads all the books into memory to ease the sorting problem. The various column types need to use different rules for sorting, something that goes beyond what ORDER BY can do.

It wouldn't be hard to "fix" this to use paged accesses when sorting by (for example) title & author, because these have db columns underneath them. Series requires a compound ordering, and dates add even more complexity.

My problem is that I no longer use this server so am not motivated to take on changes of this complexity. I have switched to the calibre content server so I can use it with Calibre Companion (the android app).

If you wish to do the changes, then you would need to change db.php (to page and to sort), the various modules like title.php to pass the paging information to the db routine, and book_base.php to understand that it is being given page segments and not the entire books array.

Another possibility would be to read only the fields required to do the current sort, do the sort, then read the entire records for the desired book ids. This is probably easier than changing to use LIMIT expressions, but won't be nearly as memory efficient.

A third possibility, perhaps the simplest, is that if displaying titles then honor only the sorting options that ORDER BY can do without difficulty. These would be the non-NULL string fields (almost all custom columns can be NULL), and possibly series if you generate the appropriate compound order by for them.
chaley is offline   Reply With Quote
Old 11-12-2012, 03:18 PM   #247
micster
Enthusiast
micster began at the beginning.
 
Posts: 39
Karma: 10
Join Date: May 2012
Device: none
Thanks chaley!

That fills in some of the pieces for me and gives me something to go on. I totally understand the motivation thing also.
micster is offline   Reply With Quote
Old 01-01-2013, 04:48 PM   #248
Kevnancy
Member
Kevnancy began at the beginning.
 
Posts: 23
Karma: 10
Join Date: Jan 2013
Device: kobo glo
Dear all,

I want to use calibre php server on my IIS8 + php 5.4.9 but it doesn't work... http error 500

What kind of DB calibre uses? sqlite3?

Do I need to modify the .php files of calibre server?

Best regards
Kevnancy is offline   Reply With Quote
Old 01-02-2013, 04:04 AM   #249
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,703
Karma: 6658935
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Kevnancy View Post
Dear all,

I want to use calibre php server on my IIS8 + php 5.4.9 but it doesn't work... http error 500

What kind of DB calibre uses? sqlite3?

Do I need to modify the .php files of calibre server?

Best regards
Calibre's db is sqlite3. With php 5.4.9 you should use the sqlite3 plugin, although I confess that I have never tried that php version.

You must modify the configuration .php file(s) as described in the INSTALL file. You shouldn't need to modify anything else, but given that I have never run the server on IIS or used php 5.4, I might be wrong. In particular, the version of smarty might force some modification of the templates.

Final note: I no longer use this server and have no strong interest in maintaining it. If you want to use a server that is under active development, see https://www.mobileread.com/forums/sho...d.php?t=170903. I don't know the state of its development or if that server will meet your needs.
chaley is offline   Reply With Quote
Old 01-03-2013, 07:14 PM   #250
claduver
Junior Member
claduver began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Oct 2012
Device: Sony PRS-T1
Windows auth & disconnect functionnality

Hello All,

First thanks to Charles for this great work !!
I've spent the last three evenings installing and configuring it on my windows XP box acting as server. It works fine, and answers all my needs.
I've put Apache 2.2.22 + PHP 5.2.17 + smarty 2.6.27 (the 3.x versions produced errors as said in another post)

Just two little add-ons I made :
1 - on windows, as you pointed out, Apache MD5 encoder doesn't work the same as PHP's so no password is recognized correctly if encrypted. I had to go for plain text.
So I added in config_local_php an entry :
$config['password_crypted'] = [true|false];
and modified index.php as below :
Moderator Notice
Changed the FONT tags around the source code to CODE tags so that indentation is not lost

Code:
if ($config['use_internal_login']) {
		$_REQUEST['msg'] = '';
		if (!isset($_SESSION['has_logged_in'])) {
			if (isset($_REQUEST['name']) && isset($_REQUEST['password'])) {
				$lines = file($config['password_file'], FILE_IGNORE_NEW_LINES);
				$upw = $_REQUEST['password'];
						
				foreach ($lines as $line) {
					list($name, $fpw) = explode(':', $line, 2);					
					if ($name == $_REQUEST['name']) {
						$cpwd = '';
						// test if password needs to be encrypted before compare with file password
						if ($config['password_crypted']) {
							$cpwd= crypt($upw, $fpw);							
						}
						else {
							$cpwd=$upw;
						}
						if ($cpwd == $fpw) {						
							$_SESSION['has_logged_in'] = $_REQUEST['name'];
							dprint("$name has logged in");
							break;
						}
					}
				}
				if (!isset($_SESSION['has_logged_in'])) {
					$_REQUEST['m'] = 'login';
					$_REQUEST['msg'] = 'invalid user name or password';
				}
			}
		}
		if (!isset($_SESSION['has_logged_in'])) {
			$_REQUEST['m'] = 'login';
		} else {
			$_SERVER['REMOTE_USER'] = $_SESSION['has_logged_in'];
		}
	}
Besides, I corrected a bug in the loop because the password was re-encrypted upon each turn.

Authentication works fine now.


2 - I have declared three users with differents rights and I felt the need to disconnect properly, so I added a "disconnect" functionality in the header and a disconnect.php file.
I also modify the styles to display the message in login page more beautifully (I used the stylesheets published by another user).
here goes in attached files.

Hope this will please you, and thanks again for your great work.

Claire.
Attached Files
File Type: zip disconnect.zip (2.0 KB, 368 views)

Last edited by chaley; 01-04-2013 at 04:33 AM.
claduver is offline   Reply With Quote
Old 01-04-2013, 04:35 AM   #251
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,703
Karma: 6658935
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
@claire: thanks for the nice words. I am glad you got it working.

I took the liberty of changing your post slightly so that the indentation of the code is not lost. I did that by changing FONT to CODE around the source code.
chaley is offline   Reply With Quote
Old 01-04-2013, 05:15 AM   #252
claduver
Junior Member
claduver began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Oct 2012
Device: Sony PRS-T1
Quote:
Originally Posted by chaley View Post
@claire: thanks for the nice words. I am glad you got it working.

I took the liberty of changing your post slightly so that the indentation of the code is not lost. I did that by changing FONT to CODE around the source code.
You did well, I wanted to make it appear like code but didn't know how to do that
claduver is offline   Reply With Quote
Old 09-28-2013, 06:28 PM   #253
Venia Legendi
Member
Venia Legendi began at the beginning.
 
Venia Legendi's Avatar
 
Posts: 13
Karma: 10
Join Date: Apr 2013
Device: lots of, frequently changing
Question Where to put disconnect.php and stylesheet.css

@chaley: Thank you very much for the php web server, more than usefull!

@claduver: Thank you also very much for the possibility to NOT encrypt the passwords!
I got this working in the index.php, after some time of course. Also I find a login.tpl and replaced the existing one.

But what should I do with disconnect.php and stylesheet.css?

Quote:
Originally Posted by claduver View Post
2 - I have declared three users with differents rights and I felt the need to disconnect properly, so I added a "disconnect" functionality in the header and a disconnect.php file.
I also modify the styles to display the message in login page more beautifully (I used the stylesheets published by another user).
here goes in attached files.
Thanks, Venia

Last edited by Venia Legendi; 09-28-2013 at 06:29 PM. Reason: Mispelled my name, yeah!
Venia Legendi is offline   Reply With Quote
Old 11-26-2013, 08:35 AM   #254
At_Libitum
Addict
At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.At_Libitum ought to be getting tired of karma fortunes by now.
 
Posts: 265
Karma: 724240
Join Date: Aug 2013
Device: KyBook
Just as an FYI in case anyone runs into the same.

Running on Apache 2.4.4/PHP 5.5.3 and Smarty 3.1.15 is a no go. I get about 3 pages worth of PHP errors above the index and below that there's two more stack traces.

Switching to Smarty 2.6.28 and sofar seems to work ok. At least its not producing php errors yet.

It may be me, although I doubt it because changing versions should be nothing more than just changing the path, but still, you never can tell.


(just trying it out so I can compare)

Last edited by At_Libitum; 11-26-2013 at 08:46 AM. Reason: typo in apache version number
At_Libitum is offline   Reply With Quote
Old 04-28-2014, 08:18 PM   #255
ilovejedd
hopeless n00b
ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.
 
ilovejedd's Avatar
 
Posts: 5,111
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
It's been a couple of years since I last messed with this and surprisingly, it still works quite well even with the latest calibre database. I actually started with COPS but the search function on that one doesn't work as well as the one in Calibre-PHP and I'd need to create a complete set of layout templates for COPS to suit my preferences. I know Calibre-PHP isn't being developed anymore but really, kudos for this.
ilovejedd is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calibre Command Line usage with PHP artoros Related Tools 13 07-01-2010 09:57 AM
Web Content Server mezme Calibre 7 01-08-2010 09:59 PM
Calibre web server on MAC I cant get to work.. any help appreciated. stustaff Calibre 5 01-06-2010 06:05 PM
Calibre - web server problems eclpmb Calibre 9 11-28-2008 02:04 PM


All times are GMT -4. The time now is 02:18 PM.


MobileRead.com is a privately owned, operated and funded community.