visit here for the static home page(just to get a feel of what it looks like): https://giantspacemonster.github.io/farmhousefresh.com/
Welcome to the college project on a e-commercial site built on html,js,css,php,psql and runs on an apache2 server.
- php 7.2
- psql 10.14
- Server Version: Apache/2.4.29
We use the LAPP(Linux, Apache, PostgreSQL, PHP) stack to develope the website. We start by installing the dependent sofwares
-
sudo apt update
sudo apt install apache2
-
By default, Apache comes with a basic site enabled. We can modify its content in
/var/www/html
Start by creating a directory in/var/www/college-project/
.
Inside of the directory created, clone this project:
sudo git clone https://github.com/giantspacemonster/farmhousefresh.com.git
Or
gh repo clone giantspacemonster/farmhousefresh.com
Create a Virtual host in apache2, enable the college-project site, and (optional) disable default apache site. Use the following tutorial to do so: https://ubuntu.com/tutorials/install-and-configure-apache#3-creating-your-own-website
-
sudo apt install postgresql postgresql-contrib
- Start PostgreSQL as root user #postgres.
sudo psql -U postgres
- Create new user
CREATE USER username WITH LOGIN PASSWORD'secretpassword';
Also set the user as superuser:
ALTER USER username WITH SUPERUSER;
- Create new Database
Also set the owner to the created username:
CREATE DATABASE databasename WITH OWNER=username;
Note that the username used in the project is farmhousefreshdb and the database used is farmhousefreshdb and the password used is 'secretpassword' - Create the tables required
Table reg:
CREATE TABLE public.reg
(
first_name character varying(40),
last_name character varying(40),
gen character varying(10),
dob timestamp without time zone,
addr character varying(150),
email character varying(40),
password character varying(30),
mno bigint,
CONSTRAINT reg_email_key UNIQUE (email),
CONSTRAINT reg_mno_key UNIQUE (mno),
CONSTRAINT reg_password_key UNIQUE (password)
)
WITH ( OIDS=FALSE ); ALTER TABLE public.reg OWNER TO farmhousefreshdb;
Table login:
CREATE TABLE public.login ( email character varying(40), password character varying(30), CONSTRAINT login_email_fkey FOREIGN KEY (email) REFERENCES public.reg (email) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE SET NULL, CONSTRAINT login_password_fkey FOREIGN KEY (password) REFERENCES public.reg (password) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE SET NULL ) WITH ( OIDS=FALSE ); ALTER TABLE public.login OWNER TO farmhousefreshdb;
Table Cart:CREATE TABLE public.cart ( sr_no integer NOT NULL DEFAULT nextval('cart_sr_no_seq'::regclass), productname character varying(40), quantity integer, price integer, CONSTRAINT cart_pkey PRIMARY KEY (sr_no) ) WITH ( OIDS=FALSE ); ALTER TABLE public.cart OWNER TO farmhousefreshdb;
Table feedback:
CREATE TABLE public.feedback ( mno bigint, message character varying(250), email character varying(40), CONSTRAINT feedback_email_fkey FOREIGN KEY (email) REFERENCES public.reg (email) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION, CONSTRAINT feedback_mno_fkey FOREIGN KEY (mno) REFERENCES public.reg (mno) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION ) WITH ( OIDS=FALSE ); ALTER TABLE public.feedback OWNER TO farmhousefreshdb;
- Start PostgreSQL as root user #postgres.