I wanted a simple web based "download and run"-SQLite browser. So my choice was of course a PHP tool, first thing to look for is something like phpMyAdmin just for SQLite.
There are two of them, with the same name "phpSQLiteAdmin":
- One by Yves Glodt
- Another one by Richard Heyes
and none of them works out of the box! So here is what I did to get number 2 (phpSQLiteAdmin by Richard Heyes) running.
I did it all on an Ubuntu machine, which is really a nice thing to have! But also for Windows user I try to point out what to do.
First of all, there is almost no documentation to it. Inside the documentation folder you find an INSTALL.txt but that doesn't tell you much more than a simple ls command says. Mainly it tells you that the configuration needs to be done in config/config.xml and that you have to adjust the file to your needs.
Prerequisites
- Apache should be runnning
- including a PHP4 (>=4.3)
Installation
- I
unpacked the file I downloaded into the DocumentRoot of my Apache of
course. It created a dicrectory where all the files are in.
- Since I expected a ready-to-go software, I simply opened the index.php in the browser - Blank page
- Somewhere the error-reporting was surely turned off. So I did a grep -rn error_repo * inside the phpSQLiteAdmin directory. Line 23 in includes/prepend.php says error_reporting(0);. I commented that out to see what error occurs.
Fatal error: Call to undefined function: applyfunction() in /var/www/sqliteadmin/includes/common.php on line 225
- Ok, that makes sense. I look at the code and found out that the function call should be common::applyFunction instead of applyFunction only. I corrected that by hand in the line given in the error message.
- Next try to call the index.php in the browser.
Fatal error: Call to undefined function: sqlite_libversion() in /var/www/sqliteadmin/includes/configChecks.php on line 62
- That looks like the sqlite lib is missing. Now there are multiple options, either modify the code and put a dl() in there, which loads the lib or add it to the php.ini and restart apache. I decided for the second option.
- Since I am installing it on an ubuntu machine (debian kind of linux) I used the Synaptic package manager to install the module php4-sqlite, probably something like apt-get install php4-sqlite
would work too, but I didn't try. As usual on ubuntu the installation
went like charme and didn't bother me with strange messages that I
don't understand ... after a while it only said "Done" - thank you! For
Windows you might want to download the php_sqlite.dll or if you want to feel geeky try the PEAR/PECL Installer on the SQLite package from there.
- Now I tried the index.php again, of course nothing else than a blank page.
- I still need to tell PHP that the sqlite extension is there. To be sure that there is really none yet I opened a phpinfo.php page, which tells me after searching for "sqlite" that there is nothing alike.
- So I search the php.ini, which is mostly somewhere in /etc or in C:\Windows I think. Again on my system I found it using find /etc -iname php.ini.
Ubuntu installed the extension right into PHP's extension dir, which is
defined inside the php.ini too. It has to be there in oder to add the
extension in the php.ini.
- Now I searched for the lines where
other extensions have already been included inside the php.ini file.
Those are mostly lines like extension=mysql.so, behind that line I simply added my extension=sqlite.so (.dll on Windows).
- Now we only need to restart the Apache and after calling the index.php again it should nicely show a login page.
Configuration
Some
people might like it easy, but this software gives you some stuff to
figure out :-). What the hell do I have a login page for if I only want
to look at a single (SQLite-) file? Well that's how it is, ok. Some
people might need it, I wouldn't.
- First thing we have to find out the login :-).
- After searching the files a bit, I remembered the advise in the INSTALL.txt to check out the config/config.xml. (Btw. you don't need to look into the config.php
file in the root of the application, it doesn't contain nothing you
would expect!). Yes, there is an "Authentication" part in the config,
which contains a username+password. The default seems to be username
"admin" and the password is "password". Yep that works, so I logged in.
- That looks good, finally I get to see what I wanted a phpMyAdmin-like screen. Great.
- Still I need to configure where the tool can find my database file. Ok, jump back into the config.xml file, there is surely some database-part that I have to configure. Yes, "List of databases" it says. I modified the <path>./example.db</path> to point to my database file and change the name to fit my needs and tried it again in the browser.
Finally it's working. That was a little more than just download and
run. But with a little bit PHP knowledge and some sense of adventure
it's a nice task for some rainy afternoon. If you rather watch TVthat afternoon I hope this summary of my experiences helps a bit.
Good luck