Can't open sqlite DB in shared 2.0 fresh install...

Having trouble installing serendipity?
Post Reply
latcarf
Regular
Posts: 25
Joined: Tue Apr 12, 2005 1:21 am
Location: Silicon Valley, CA
Contact:

Can't open sqlite DB in shared 2.0 fresh install...

Post by latcarf »

Hi all,

I tried a fresh "shared" installation of 2.0 with sqlite tonight and after setup, clicking "Visit your new blog here" got the following error:

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [14] unable to open database file' in /usr/local/lib/php/serendipity2/s9y/include/db/pdo-sqlite.inc.php:105 Stack trace: #0 /usr/local/lib/php/serendipity2/s9y/include/db/pdo-sqlite.inc.php(105): PDO->__construct('sqlite:/usr/loc...') #1 /usr/local/lib/php/serendipity2/s9y/serendipity_config.inc.php(295): serendipity_db_connect() #2 /home/me/serendipity/serendipity_config.inc.php(8): require_once('/usr/local/lib/...') #3 /usr/local/lib/php/serendipity2/s9y/index.php(23): include('/home/me/serend...') #4 /home/me/serendipity/index.php(6): require_once('/usr/local/lib/...') #5 {main} thrown in /usr/local/lib/php/serendipity2/s9y/include/db/pdo-sqlite.inc.php on line 105

My open_basedir is:
"/tmp:/usr/local/lib/php/:/usr/local/lib/php/serendipity2/s9y/:/home/me/serendipity/"

DB file is created OK and listed correctly in serendipity_config_local.inc.php.

https user ("apache") has write access to both the db and the main directory (verified since it created the db OK).

Any thoughts...?
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Can't open sqlite DB in shared 2.0 fresh install...

Post by Timbalu »

just guessing..., this is while the db resides in open_basedir path, but Serendipity path is in /home/..

Try with /include/db/pdo-sqlite.inc.php(105)

As a one-liner before:

Code: Select all

$serendipity['dbConn'] = new PDO('sqlite:' . $serendipity['serendipityPath'] . $serendipity['dbName'] . '.db');
and then:

Code: Select all

$serendipity['dbConn'] = new PDO('sqlite:' . $serendipity['dbName'] . '.db');
What does it do?
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
latcarf
Regular
Posts: 25
Joined: Tue Apr 12, 2005 1:21 am
Location: Silicon Valley, CA
Contact:

Re: Can't open sqlite DB in shared 2.0 fresh install...

Post by latcarf »

Thanks Timbalu! That fixes the problem but I don't fully understand why...

Serendipity is installed in /usr/local/lib/php/serendipity2/s9y since it's a shared installation but the database is created (by default) in /home/me/serendipity/. The open_basedir contains "/home/me/serendipity/."

Your fix seems to indicate that $serendipity['serendipityPath'] is "/usr/local/lib/php/serendipity2/s9y" in the shared install case. Is that true?

So, my other question is, how can I accomplish this fix without having to patch /include/db/pdo-sqlite.inc.php(105)?

Thanks for your help fixing it in the first place!!
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Can't open sqlite DB in shared 2.0 fresh install...

Post by Timbalu »

latcarf wrote:Your fix seems to indicate that $serendipity['serendipityPath'] is "/usr/local/lib/php/serendipity2/s9y" in the shared install case. Is that true?
I don't know. What does the Configuration - Path - Full Path option field say?
latcarf wrote:So, my other question is, how can I accomplish this fix without having to patch /include/db/pdo-sqlite.inc.php(105)?
It depend on how this should work. Maybe the local db install in /home is totally OK, since a shared installation having each users its own database. So maybe we need to reset the sqlite $serendipity['serendipityPath'] for shared installs.

I think we will have to wait for Garvin showing up, to give some concrete suggestions on what to do here.

Edit: I had some more thoughts on this ... maybe you should write for shared installs

Code: Select all

$serendipity['dbConn'] = new PDO('sqlite:' . S9Y_DATA_PATH . $serendipity['dbName'] . '.db');
instead. Give it a try.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Can't open sqlite DB in shared 2.0 fresh install...

Post by garvinhicking »

Great find. Fixed here: https://github.com/s9y/Serendipity/issu ... t-54944875

Thanks,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
latcarf
Regular
Posts: 25
Joined: Tue Apr 12, 2005 1:21 am
Location: Silicon Valley, CA
Contact:

Re: Can't open sqlite DB in shared 2.0 fresh install...

Post by latcarf »

Fixed here: https://github.com/s9y/Serendipity/issu ... t-54944875
Awesome! Thanks.
Post Reply