Create a Node.js webserver

To create a node webserver, the core http module needs to be included. To include an existing module you can use the require function.

var http = require("http");

http.createServer(function(request, response) {
    response.write("Luke, I am your server");

See the difference with a node server using express

Install SQLite on Ubuntu

SQLite can be installed by typing the following command in command line:

sudo apt-get install sqlite3 libsqlite3-dev

You can see if SQLite is installed properly by typing sqlite3 in command line.


Quit SQLite by typing .exit.

Help is on the way when typing .help.


Drop MongoDB database in PHP

// Establish connection.
$connection = new Mongo();

// Select database.
$database = $connection->demo;

// Drop database.
$dropped = $database->drop();

// Close connection.

First steps using MongoDB in PHP

// Establish connection.
$connection = new Mongo();
// Select database, create database if database not exists.
$database = $connection->demo;
// Select collection.
$collection = $database->users;
// Insert data.
$user = array(
  'name' => 'Dribbit',
  'email' => '',

// Get all records.
$records = $collection->find();
foreach($records as $record) {

// Close connection.

Where does mongodb stores data

Type following command in command line terminal:

sudo nano /etc/mongodb.conf



This is based on an Ubuntu system.

Install MongoDB driver for PHP on Ubuntu

Type following line in command line:

sudo pecl install mongo

If Pecl throws this error: configure: error: sasl.h not found! add following command and retry installing mongodb

sudo apt-get install libsasl2-dev

After installing, add the mongo extension to php.ini

Restart apache:

Get current Ubuntu version

Get Ubuntu version by typing

lsb_release -a

in command line.


My current version is 14.4


Install MongoDB on Ubuntu

32 bit systems are limited to DB of 2 gig. Therefor, use MongoDB only on 64 bit systems in production.

@see MongoDb documentation to install MongoDB.

See if MongoDB is running by typing

sudo service mongodb status

in command line.



Subscribe to RSS - Novice