TorrentFlux.com Welcome, Guest. Please login or register.
02-09-2010, 03:20:38
Home Help Search Login Register donate
TorrentFlux Home | TorrentFlux Hosting

+  TorrentFlux Forums
|-+  Code Hacks and Tools
| |-+  TorrentFlux 2.0 Hacks
| | |-+  Torrentflux with SQLite and LightTPD
« previous next »
Pages: [1] 2 3  All Go Down Print
Author Topic: Torrentflux with SQLite and LightTPD  (Read 44346 times)
akhbit
Newbie
*
Offline Offline

Posts: 5



View Profile
« on: 02-09-2006, 20:12:03 »

I have torrentflux running in my debianized NSLU2 but Apache and MySQL are quite the recource hogs for the puny 133/266MHz ARM processor. As a solution I changed Apache to LightTPD + php5-cgi and MySQL to SQLite. I haven't really benchmarked it yet but at least it feels to be running A LOT smoother now.

Since i had quite an amount of trouble getting the SQLite running I decidet to post this _short_ HOWTO to help othes in similar trouble. 

Setting up LightTPD was a breeze following the instructions found at http://trac.lighttpd.net/trac/wiki/TutorialLighttpdAndPHP I'm using Debian unstable so I coud just apt-get the lighttpd and php5-cgi packages.

Following changes were made to confs:

/etc/lighttpd/lighttpd.conf
ADD
fastcgi.server = ( ".php" => ((
                     "bin-path" => "/usr/bin/php5-cgi",
                     "socket" => "/tmp/php.socket",
                 )))

/etc/php5/cgi/php.ini
MODIFY
# cgi.fix_pathinfo = 0
to
cgi.fix_pathinfo = 1

After reloading lighttpd php should be up and running.

SQLite:

ADOdb can't handle SQLite3 databases yet so I had to settle for SQLite 2.x. I suppose it doesn't affect torrentflux that much but I had to edit the orginal torrentflux.sql-fire a bit more.

Install SQLite:
apt-get install sqlite php5-sqlite

This required no configuration at all.

create the SQLite database using the customized sql-file:
sqlite torrentflux.db
sqlite>.read /path/to/sqlite2-torrentflux.sql
sqlite>.quit

now just put the resulted torrentflux.db file somewhere where lighttpd can access it and make sure that lighttpd (usually user www-data) has rights to access it.

Config torrentflux:
/var/www/torrentflux/config.php
MODIFY
$cfg["db_type"] = "mysql";
$cfg["db_host"] = "localhost";
to
$cfg["db_type"] = "sqlite";
$cfg["db_host"] = "/path/to/torrentflux.db";

db_name/user/pass fields are not used with SQLite so you can let them be at default values.
Do the usual torrentflux confs...

That's it. I'm attaching the modified .sql file and the ready SQLite .db file. They should work. (just strip the .txt from filenames)
So this is how I got the thing working... hopefully this helps someone in need of lightweight paltform for torrentflux...

-Akhbit
Logged
IhatemyISP
Forum Code Monkey
Hero Member
*****
Offline Offline

TF Base: Linux 2.x
Posts: 841






View Profile WWW
« Reply #1 on: 02-10-2006, 09:42:13 »

Very nicely done Smiley
Logged

Pentium III 667mhz | 155GB RAID 0 | 256MB RAM | Redhat 7.3 - 2.4.18-3 | Python 2.4.1 | PHP 5.1.4 (cgi-fcgi) | Lighttpd 1.4.11
Diggo
Newbie
*
Offline Offline

Posts: 6



View Profile
« Reply #2 on: 03-14-2006, 08:11:37 »

Hi, do you use Open Debian  on your Slug, or which one? Afaik there are more than one Debian Dists for the Slug.
Logged
sylver
Jr. Member
**
Offline Offline

Posts: 87





View Profile
« Reply #3 on: 03-14-2006, 10:07:41 »

Do anyone managed to use sqlite with TF 2.1 ?
I updated the sqlite file according to new fields for TF 2.1, but i do have this error :
Code:
Database error: SQL logic error or missing database
Always check your database variables in the config.php file.
in my config.php :
Code:
$cfg["db_type"] = "sqlite";
$cfg["db_name"] = "/mnt/torrent/tf.sql";

Could it be a problem with my php installation or something like that ? If not, i could i have an error message a little more explicit ?

Thanks

Sylver
Logged
akhbit
Newbie
*
Offline Offline

Posts: 5



View Profile
« Reply #4 on: 03-14-2006, 12:01:53 »

Hi, do you use Open Debian  on your Slug, or which one? Afaik there are more than one Debian Dists for the Slug.


Yep, I'm using Debian etch (testing). Installed using the method by Peter Korsgaard (http://peter.korsgaard.com/articles/debian-nslu2.php) aka. the orginal Debian for NSLU2... Works propably as well with any installation that uses standard debian repositories...

-Akhbit
Logged
Qrome
Administrator
Hero Member
*****
Offline Offline

TF Base: Linux 2.x
Posts: 2783


TorrentFlux.com





View Profile
« Reply #5 on: 03-14-2006, 15:25:34 »

Do anyone managed to use sqlite with TF 2.1 ?
I updated the sqlite file according to new fields for TF 2.1, but i do have this error :
Code:
Database error: SQL logic error or missing database
Always check your database variables in the config.php file.
in my config.php :
Code:
$cfg["db_type"] = "sqlite";
$cfg["db_name"] = "/mnt/torrent/tf.sql";

Could it be a problem with my php installation or something like that ? If not, i could i have an error message a little more explicit ?

Thanks

Sylver

I think you need to use db_host not db_name:

$cfg["db_host"] = "/path/to/torrentflux.db";
Logged

Check out the new FireFox Extension by IceWind for TorrentFlux called TorrentFlux Add -- right click on torrents and have them added to your TorrentFlux list.
sylver
Jr. Member
**
Offline Offline

Posts: 87





View Profile
« Reply #6 on: 03-14-2006, 16:41:56 »

you're right Qrome Wink
Thanks a lot !

Now i got this error :
Code:
Debug SQL is on.

SQL: UPDATE tf_settings SET tf_value = '/www/torrentflux_2.1/html/TF_BitTornado/btphptornado.py' WHERE tf_key = 'btphpbin' LIMIT 1


Database error: SQL logic error or missing database

Always check your database variables in the config.php file.

I'll check later what's wrong !

edit : i can login, add some torrents, but if i try to update the configuration from html/admin.php?op=configSettings, i got these kind of error :
Code:
Debug SQL is on.

SQL: UPDATE tf_settings SET tf_value = '/mnt/torrent/' WHERE tf_key = 'path' LIMIT 1


Database error: SQL logic error or missing database

Always check your database variables in the config.php file.
« Last Edit: 03-14-2006, 16:47:41 by sylver » Logged
Qrome
Administrator
Hero Member
*****
Offline Offline

TF Base: Linux 2.x
Posts: 2783


TorrentFlux.com





View Profile
« Reply #7 on: 03-14-2006, 17:38:07 »

remove the limit 1 since it is specifig to MySQL -- it has already been removed from the TF 2.1 code base and will not be included in the next release.
Logged

Check out the new FireFox Extension by IceWind for TorrentFlux called TorrentFlux Add -- right click on torrents and have them added to your TorrentFlux list.
sylver
Jr. Member
**
Offline Offline

Posts: 87





View Profile
« Reply #8 on: 03-14-2006, 17:49:54 »

Thanks Qrome, it's working perfectly now !
What i did :
in settingsfunctions.php, removed the "LIMIT 1" in function updateSetting (line 126 for TF 2.1 b5)
Logged
Diggo
Newbie
*
Offline Offline

Posts: 6



View Profile
« Reply #9 on: 03-17-2006, 07:18:56 »

For all those who are interested in:

There ist a new release of the Debian (Etch) installer, that is now capable of installing Debian Etch on a
NSLU2

For more information see:
Martin Michlmayr
http://www.cyrius.com/debian/nslu2/

I think i'll give it a try.

If I succeed, i think i'll write a howto for
NSLU2 + Debian(Etch) + Torrentflux 2.0b1
Logged
IhatemyISP
Forum Code Monkey
Hero Member
*****
Offline Offline

TF Base: Linux 2.x
Posts: 841






View Profile WWW
« Reply #10 on: 03-17-2006, 12:36:39 »

A howto would be great!
Logged

Pentium III 667mhz | 155GB RAID 0 | 256MB RAM | Redhat 7.3 - 2.4.18-3 | Python 2.4.1 | PHP 5.1.4 (cgi-fcgi) | Lighttpd 1.4.11
prezet
Newbie
*
Offline Offline

Posts: 6



View Profile
« Reply #11 on: 03-18-2006, 20:43:18 »

Hi all

I'm here from the Transmission forums to try to get this to work on my linkstation.
I've followed everything so far, and I'm trying to do it with lighttpd and sqlite.

My first problem was getting sqlite to .read from the modified .sql file.  It didn't create a db.
So instead I downloaded the uploaded torrentflux.db and placed it on my websever, chmod +x'd it, but every thime I try to access the torrentflux's /html/index.php I get the following error:

Code:
Warning: sqlite_open() [function.sqlite-open]: database disk image is malformed in /mnt/hda/webserver/html/adodb/drivers/adodb-sqlite.inc.php on line 138

Warning: Cannot modify header information - headers already sent by (output started at /mnt/hda/webserver/html/adodb/drivers/adodb-sqlite.inc.php:138) in /mnt/hda/webserver/html/functions.php on line 83

Any ideas?
Logged
prezet
Newbie
*
Offline Offline

Posts: 6



View Profile
« Reply #12 on: 03-18-2006, 21:08:48 »

ok, got a bit further, seems there was a problem with the location of my php.ini

Anyway, not I get to a log-in screen, and whatever login and password I enter it rejects....?!  Any ideas?
Logged
Qrome
Administrator
Hero Member
*****
Offline Offline

TF Base: Linux 2.x
Posts: 2783


TorrentFlux.com





View Profile
« Reply #13 on: 03-18-2006, 22:19:28 »

Make sure you have sessions enabled and installed.
Logged

Check out the new FireFox Extension by IceWind for TorrentFlux called TorrentFlux Add -- right click on torrents and have them added to your TorrentFlux list.
prezet
Newbie
*
Offline Offline

Posts: 6



View Profile
« Reply #14 on: 03-19-2006, 05:11:57 »

Hi Qrome

Sessions are enabled, but thanks.
Heres the output from the error_log:

Code:
[19-Mar-2006 11:07:44] PHP Notice:  A session had already been started - ignoring session_start() in /mnt/hda/webserver/html/login.php on line 28
[19-Mar-2006 11:07:44] PHP Warning:  sqlite_open() [<a href='function.sqlite-open'>function.sqlite-open</a>]: database disk image is malformed in /mnt/hda/webserver/html/adodb/drivers/adodb-sqlite.inc.php on line 138
[19-Mar-2006 11:07:54] PHP Notice:  A session had already been started - ignoring session_start() in /mnt/hda/webserver/html/functions.php on line 26
[19-Mar-2006 11:07:54] PHP Notice:  Undefined index:  user in /mnt/hda/webserver/html/functions.php on line 27
[19-Mar-2006 11:07:54] PHP Warning:  sqlite_open() [<a href='function.sqlite-open'>function.sqlite-open</a>]: database disk image is malformed in /mnt/hda/webserver/html/adodb/drivers/adodb-sqlite.inc.php on line 138
[19-Mar-2006 11:07:55] PHP Notice:  A session had already been started - ignoring session_start() in /mnt/hda/webserver/html/login.php on line 28
[19-Mar-2006 11:07:55] PHP Notice:  Undefined index:  username in /mnt/hda/webserver/html/login.php on line 110
[19-Mar-2006 11:07:55] PHP Notice:  Undefined index:  iamhim in /mnt/hda/webserver/html/login.php on line 111
[19-Mar-2006 11:08:02] PHP Notice:  A session had already been started - ignoring session_start() in /mnt/hda/webserver/html/login.php on line 28
[19-Mar-2006 11:08:02] PHP Warning:  sqlite_open() [<a href='function.sqlite-open'>function.sqlite-open</a>]: database disk image is malformed in /mnt/hda/webserver/html/adodb/drivers/adodb-sqlite.inc.php on line 138

Huh? confused.
Logged
Pages: [1] 2 3  All Go Up Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by SMF 1.1.1 | SMF © 2006, Simple Machines LLC Powered by PHP