How to host invo (Tutorial 2) on php builtin server and sqlite3.

Greetings people!

This is my first post in this forum . Me exploring phalcon since 2 days and was able to host invo on php built in server and sqlite.

I hope the following information helps:

scribling...

  • installed git, php plugged with phalcon.
  • Dogit checkout invo into say C:\phalcon\www
  • Modify 'config.ini'. Thanks for the info in the discussion 2126
  • Create schema C:\phalcon\www\invo\schemas\invo-sqlite.sql.
  • Create sqlite database C:\phalcon\www\invo\invo.db and initialize schema
$ sqlite C:\phalcon\www\invo\invo.db
$ cd C:\phalcon\www\invo
$ type invo/schemas/invo-sqlite.sql | sqlite3 invo.db
  • Start the PHP bulitin server
$ cd C:\phalcon\www
$ php -S localhost:80 -t C:\phalcon\www\invo\public C:\phalcon\www\invo\.htrouter.phalconphp
  • The contents of the file config.ini
[database]
adapter  = Sqlite
dbname   = C:\phalcon\www\invo\invo.db

[application]
controllersDir = app/controllers/
modelsDir      = app/models/
viewsDir       = app/views/
pluginsDir     = app/plugins/
formsDir       = app/forms/
libraryDir     = app/library/
baseUri        = /
  • The contents of the file invo-sqlite.sql
$ type C:\phalcon\www\invo\schemas\invo-sqlite.sql
PRAGMA encoding = "UTF-8";

DROP TABLE IF EXISTS 'companies';
CREATE TABLE 'companies' (
  'id' INTEGER PRIMARY KEY AUTOINCREMENT,
  'name' VARCHAR(70) NOT NULL,
  'telephone' VARCHAR(30) NOT NULL,
  'address' VARCHAR(40) NOT NULL,
  'city' VARCHAR(40) NOT NULL
);

INSERT INTO 'companies' (name, telephone, address, city) VALUES ('Acme','31566564','Address','Hello');
INSERT INTO 'companies' (name, telephone, address, city) VALUES ('Acme Inc','+44 564612345','Guildhall, PO Box 270, London','London');

DROP TABLE IF EXISTS 'contact';
CREATE TABLE 'contact' (
  'id' INTEGER PRIMARY KEY AUTOINCREMENT,
  'name' VARCHAR(70) NOT NULL,
  'email' VARCHAR(70) NOT NULL,
  'comments' TEXT NOT NULL,
  'created_at' DATETIME DEFAULT CURRENT_TIMESTAMP
);

DROP TABLE IF EXISTS 'product_types';
CREATE TABLE 'product_types' (
  'id' INTEGER PRIMARY KEY AUTOINCREMENT,
  'name' VARCHAR(70) NOT NULL
);

DROP TABLE IF EXISTS 'products';
CREATE TABLE 'products' (
  'id' INTEGER PRIMARY KEY AUTOINCREMENT,
  'product_types_id' INTEGER NOT NULL,
  'name' VARCHAR(70) NOT NULL,
  'price' DECIMAL(16,2) NOT NULL,
  'active' TEXT CHECK( active IN ('Y','N') ) NOT NULL DEFAULT 'N'
);

INSERT INTO 'products' (product_types_id, name, price, active) VALUES (5,'Artichoke',10.50,'Y');
INSERT INTO 'products' (product_types_id, name, price, active) VALUES (5,'Bell pepper',10.40,'Y');
INSERT INTO 'products' (product_types_id, name, price, active) VALUES (5,'Cauliflower',20.10,'Y');
INSERT INTO 'products' (product_types_id, name, price, active) VALUES (5,'Chinese cabbage',15.50,'Y');
INSERT INTO 'products' (product_types_id, name, price, active) VALUES (5,'Malabar spinach',7.50,'Y');
INSERT INTO 'products' (product_types_id, name, price, active) VALUES (5,'Onion',3.50,'Y');
INSERT INTO 'products' (product_types_id, name, price, active) VALUES (5,'Peanut',4.50,'Y');


DROP TABLE IF EXISTS 'users';
CREATE TABLE 'users' (
  'id' INTEGER PRIMARY KEY AUTOINCREMENT,
  'username' VARCHAR(32) NOT NULL,
  'password' VARCHAR(40) NOT NULL,
  'name' VARCHAR(120) NOT NULL,
  'email' VARCHAR(70) NOT NULL,
  'created_at' DATETIME DEFAULT CURRENT_TIMESTAMP,
  'active' TEXT CHECK( active IN ('Y','N') ) NOT NULL DEFAULT 'N'
);

INSERT INTO 'users' (username, password, name, email, created_at, active) VALUES ('demo','c0bd96dc7ea4ec56741a4e07f6ce98012814d853','Phalcon Demo','[email protected]','2012-04-10 20:53:03','Y');

And what's your problem ? What error you have ?