SQLite, PHP and Portable Abyss Web Server X1

Tuesday, May 19th, 2009

Tags: ,

I was looking for a portable web server for a long time. And finaly I have found one. You might have read about that in my last post. Just after I started using this web server, I began to worry about databases. How can I port mySQL with me? At that moment the idea of using SQLite clicked in my head. I have heard a lot about SQLIte in the past and now the time has come to make my hands dirty with bits of it. I started learning about SQLIte. The great thing is that PHP has a SQLIte extension. Just enable it and you have your own server less and self contained database engine. Great ! Isn’t it?

I also visited the SQLite home page at http://sqlite.org. You’ll find detailed information and various downloads, docs and other resources regarding SQLite. I downloaded the SQLite command line tool to practise managing SQLite databases without laying hands on php. I no longer have to start off a web server to execute SQLite queries.

Now I have a total platform ready to build web apps which can be used offline. Instead of writing GUI apps with WinBinder or PHP-GTK, I will write offline web apps. The interfaces would be in HTML served in a web browser. The apps will be deployed using the portable web server. I will have to work out a configuration file for the web server so that it runs without reconfiguring every time I port it. If I can manage to do that, I will simply write a web based software, install it inside the web server and then distribute the whole server to my users. All they would need is to start off the server and visit http://localhost. The app would be ready there.

The apps will be portable. They would run on the web and on local machines having WAMP, LAMP, MAMP or XAMPP.

I am currently focusing more on SQLIte. It’s not that hard to learn. I am making decent progress. The SQLite extension for php has both procedural and object oriented accessibility making it more of fun.

Here’s a little code snippet :

CODE:
<?php
if($db = sqlite_open(“masnun”,0666,$err)) {
sqlite_exec($db,”Create table masnun (name varchar(255), email varchar(255))”);
sqlite_exec($db,”insert into masnun (name,email) values (‘masnun’,'masnun@gmail.com’)”);
sqlite_exec($db,”insert into masnun (name,email) values (‘masnun2′,’masnun@ymail.com’)”);
$res = sqlite_array_query($db,”select * from masnun”,SQLITE_ASSOC);
// print_r($res);
for ($i=0;$i“; }
}
?>

OUTPUT:
Data: masnun — masnun@gmail.com
Data: masnun2 — masnun@ymail.com

Hurray!! I can do it… Yeah !

One Response to “SQLite, PHP and Portable Abyss Web Server X1”

  1. [...] SQLite, PHP and Portable Abyss Web Server X1 « maSnun.com (tags: software windows httpd php website abyss) [...]

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">