How To Create Fast Simple Database and Table With Php and Sqlite

Php is web programming language very popular among developers. Php is actually a scripting language which means there is no need to compile the code to run. So write and run is the motto of php language. Php scripts can be run on linux systems like bash, perl scripts too. Some administrators with development background prefers php for scripting because php offers more than bash scripting. Sqlite is an other popular database which is designed for simple, realiable and fast usage. Sqlite do not need any setup and service to run. Just sqlite library and create a database file like Microsoft Access mdb and work. In this tutorial we will look how to create simple and fast php application in bash which uses sqlite database for storing data.

Install Php & Sqlite

Ubuntu,Debian

Fedora,CentOS

1

$yum install-yphp sqlite

Test Php

Php installation can be tested like below. We will run simple php code with php interpreter.

1

2

$php-r"echo 'Hi Poftut';"

Hi Poftut

We can run php as above

php is our Php interpreter command

-r will run our code “echo ‘Hi Poftut’; ”

Initialize Sqlite Database With Php

We will create a database file with php script. And then create a table. Our php script file name is createdb.php